Created
September 26, 2008 16:50
-
-
Save joefiorini/13148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShowsController < ApplicationResourceController | |
def route_name | |
'show' | |
end | |
def resource_name | |
'show' | |
end | |
def model_name | |
'show' | |
end | |
def object_name | |
'show' | |
end | |
def collection | |
if params[:nowplaying] | |
@collection ||= Show.nowplaying | |
elsif params[:upcoming] | |
@collection ||= Show.upcoming | |
else | |
@collection ||= end_of_association_chain.find(:all) | |
end | |
end | |
def object | |
if params[:id] =~ /^\d+$/ | |
@show ||= Show.find params[:id] | |
elsif params[:id] | |
@show ||= Show.find_by_name params[:id] | |
else | |
@object | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment