Skip to content

Commit

Permalink
Take first 9 items of Track#playlists in order to reduce api traffic
Browse files Browse the repository at this point in the history
  • Loading branch information
kumabook committed Apr 29, 2018
1 parent 6df1e9f commit 0b3d1fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ def permalink_url
end
end

def playlists
pick_containers.select { |enc| enc.type == Playlist.name }
def playlists(per_page: 9)
items = pick_containers.select { |enc| enc.type == Playlist.name }
items.take(per_page) if per_page.present?
end

def as_detail_json
Expand Down

0 comments on commit 0b3d1fa

Please sign in to comment.