Creating a good search solution
Posted
by
Daniel
on Stack Overflow
See other posts from Stack Overflow
or by Daniel
Published on 2011-01-08T14:38:01Z
Indexed on
2011/01/08
14:54 UTC
Read the original article
Hit count: 97
ruby-on-rails3
I have an app where users have a role,a username,faculty and so on.When I'm looking for a list of users by their role or faculty or anything they have in common I can call (among others possible)
@users = User.find_by_role(params[:role]) #or
@users = User.find_by_shift(params[:shift])
So it keeps the system
Class.find_by_property
So the question is: What if at different points users lists should be generated based on different properties.I mean: I'm passing from different links
- params[:role] or
- params[:faculty] or
- params[:department]
to my list action in my users controller.As I see it all has to be in that action,but which parameter should the search be made by?
© Stack Overflow or respective owner