[Rails] Re: logic for a search method

2009-02-09 Thread bingo bob
alberto wrote: > the params in the Controller is a method that returns the hash coming > to the request. So you can pass the whole params method in the call. > > @schools = School.search(params) Many thanks, after staring at this for while I figured it. Thanks for your help with this it works g

[Rails] Re: logic for a search method

2009-02-08 Thread alberto
the params in the Controller is a method that returns the hash coming to the request. So you can pass the whole params method in the call. @schools = School.search(params) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

[Rails] Re: logic for a search method

2009-02-08 Thread bingo bob
Alberto (or anyone)... How do I pass in the params from the controller to use the method... Something like # @schools = School.search(params[:search_by_name], params[:search_by_place]) But that gives me .. wrong number of arguments (2 for 1) -- Posted via http://www.ruby-forum.com/

[Rails] Re: logic for a search method

2009-02-07 Thread jammanbo
On Feb 7, 3:09 pm, bingo bob wrote: > I'm trying to ask users for a name and a place and then give them a list > of all the names OR all the places OR the names in that place, if you > get me? This is my flawed attempt, I'm passing params correctly so it's > just the logic within the method I n

[Rails] Re: logic for a search method

2009-02-07 Thread alberto
A couple of things: 1) You want to make sure you protect against SLQ injection, so do not pass the variables without escaping them. Rails does this for you when it substitutes the ? in the find method. 2) You can use the code below to do what you want. Hope that helps, Alberto.