laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org
2008-Feb-01 21:12 UTC
automatically create a search form for my model
Hi, Is there a way that scaffold or some other tool can be used to create a form that allows you to search for records in a model based on the fields of that model? I''ve seen scaffold generates a "list" page, but that doesn''t filter based on any criteria. (Or does it?) My model is called "user" and the controller by which I wish to search for records is Admin::UserController. Thanks, - Dave --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/1/08, laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org <laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org> wrote:> Is there a way that scaffold or some other tool can be used to create > a form that allows you to search for records in a modelRecords aren''t in a model, they''re in the database.> based on the > fields of that model?Well, yeah.. if you search a table then you have to use one it''s fields to search by.> I''ve seen scaffold generates a "list" page, but > that doesn''t filter based on any criteria. (Or does it?)No clue, I don''t use scaffolding.> My model is called "user" and the controller by which I wish to search > for records is Admin::UserController.The controller has nothing to do with the model in this respect. @users = User.find( :all, :conditions => [ ''name = ?'', params[:name] ] ) -- Greg Donald http://destiney.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---