Ruby on Rails Monday, April 2, 2012

I have pagination on my users table at the moment which works fine as I
only have one search feature for users.

But I now wish to add pagination to my games table but not sure how to
implement it as I have 5 search features for games. I was wondering how
I would go about adding the pagination to the following controller
method.

def index
@games = Game.gamsearch(params[:gamsearch])
@games = Game.consearch(params[:consearch]) if
params[:consearch].present?
@games = Game.gensearch(params[:gensearch]) if
params[:gensearch].present?
@games = Game.where("game_name LIKE ?", "#{params[:game_name]}%") if
params[:game_name].present?
@games = Game.where("console = ?", params[:console]) if
params[:console].present?

end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment