Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Search feature allowing me to refuse the index action for multiple filters from different sections.
- ## There has to be a way to make this way way way way tidier.
- ## Give them sensible names, not just "s" "t" or "u", someone else may be maintaining this code one day.
- def index
- if params[:s]
- @events = Event.search(params[:s], :page => params[:page])
- flash[:notice] = "#{@events.size} events found"
- elsif params[:t]
- @events = Event.find_bysomething
- # set this in a before filter, should always be done via /users/name/events
- # Do a find for the user (params[:user_id]) and one for the category id too
- elsif @object
- @events = @object.events.paginate(:page => params[:page])
- # TODO: Define a to_s method on User model that calls the login method
- # TODO: Define a to_s method on Category model that calls the category method
- flash[:notice] = "Showing events for #{@object}"
- else
- @events = Event.paginate(:page => params[:page])
- end
- end
Add Comment
Please, Sign In to add comment