Skip to content

Commit

Permalink
Merge pull request #62 from DigitalNZ/ed/nil-position-fix
Browse files Browse the repository at this point in the history
BUG: STORY ITEM NIL POSITION
  • Loading branch information
Edwin Rozario authored Feb 3, 2022
2 parents e6aa01d + 33995cd commit e60af84
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/supplejack/story_item_relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ def respond_to_missing?(_method, *_args, &_blocks)
private

def build_items(items)
@items = items.map do |hash|
Supplejack::StoryItem.new(hash.merge(story_id: story.id, api_key: story.api_key))
end.sort_by(&:position)
story_items = items.map do |item|
Supplejack::StoryItem.new(item.merge(story_id: story.id, api_key: story.api_key))
end

@items = story_items.sort_by { |i| i.position.to_i }
end
end
end

0 comments on commit e60af84

Please sign in to comment.