Skip to content

Instantly share code, notes, and snippets.

@shanebo
Last active December 11, 2015 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanebo/4680222 to your computer and use it in GitHub Desktop.
Save shanebo/4680222 to your computer and use it in GitHub Desktop.
class Api::ShowsController < ApiController
caches_page :index
def index
@shows = Show.order('id ASC').all
index = {}
@shows.each do |show|
show.image = show.image_url(:large)
index[show.id] = show
end
response = {
meta: {
type: 'index',
name: 'shows',
order: @shows.collect { |show| show.id }
},
index: index
}
render json: response, callback: params[:callback]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment