Why find_by_sql works and find(args) doesn't


#1

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%>
<%end%>

thanks.


#2

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 http://www.ruby-forum.com/.


Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
João Pessoa, PB, +55 83 8867-7208