On 9 August 2011 06:36, praveen k. <[email protected]> wrote: > Hi, > please can anyone help me with this code....when i am executing the > following code, i am getting the error. > > code: > @animals=Bird.find(:all,:conditions =>['state like?', '%' + > params[:number]+'%']) > @[email protected](:all,:conditions =>['city like?', '%bad%']) > > error: > wrong number of arguments (2 for 0..1)
Is it as simple as the fact that you have not got a space before the ?, so that rails does not recognise it as a value to be filled in? Otherwise which line is generating the error? Note that if you use the rails console you can type statements directly into the console to see whether they work which can help to diagnose which bit of a statement is giving problems. params will not be available of course but you can try it with fixed text to check it works. However you do it a useful approach is to simplify the failing statement right down to something that works, then build it up to what you really want and then you will find the detail that is causing the problem. As I said you can do most of this in the rails console. Colin Colin > > please can anyone help me out. > Thanks. > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

