Forum: Ruby on Rails Why find_by_sql works and find(args) doesn't

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jay P. (Guest)
on 2008-10-09 05:01
I'm trying to use Campsite.find(:all, :condition => ['walk_id =
?',params[:walks][:id]]) but fails and instead, if I use
Campsite.find_by_sql("select * from campsites where walk_id =
"+params[:walks][:id]), it works fine. So, I'm wondering why..
I've created combo box as:
<%form_tag do%>
 <%=select :walks, :id, @great_walks%>

Maurício L. (Guest)
on 2008-10-09 05:48
(Received via mailing list)
It's "conditions", not "condition":

Campsite.find(:all, :conditions => ['walk_id = ?',params[:walks][:id]])

On Wed, Oct 8, 2008 at 10:01 PM, Jay P.
<removed_email_address@domain.invalid> wrote:
> thanks.
> --
> Posted via
> >

Maurício Linhares (pt-br) |
João Pessoa, PB, +55 83 8867-7208
This topic is locked and can not be replied to.