Saturday, September 18, 2010

[Rails] Re: Performing nested queries in rails

> [...] Hence I am trying to apply the where condition on
> @restaurants, using  @restaurants = @restaurants.where("cuisine
> like ?", params[:cuisine]). But that doesn't work.

Once you've gotten @restaurants you are not querying the DB anymore,
hence the 'where' should give you an error. @restaurants is in essence
an array and will not have a 'where' method in it unless you add it.
Look into the Ruby methods for Array (http://ruby-doc.org/core/classes/
Array.html
) and you'll probably find what you're looking for.

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate