Forum: Ruby on Rails Querying using Ruby on Rails

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.
Venugopal (Guest)
on 2007-05-11 11:21
Hi Everyone....

I'need to query using Ruby on rails...dynamically rather than hard
coding the
statement like:
select* from authors where name="Hello";

i need to get the value of the name from a text box in the earlier page
and transfer the value to the next page and  have a statement like

select * from author where name=" #{@username}"

similar to this so tat my search could be dynamic ....

i've tried with find_by_sql... but don't know which file i need to add
the code...

Thanks & Regards

Yuri L. (Guest)
on 2007-05-11 11:56
(Received via mailing list)

In Rails you rarely need to use find_by_sql.

You can easily do things like this with

Why don't read a bit more about ActiveRecord and Rails in general?


On 5/11/07, Venugopal <removed_email_address@domain.invalid> wrote:
> Venugopal
> --
> Posted via
> >

Best regards,
Yuri L.
Zach I. // LT3media (Guest)
on 2007-05-11 12:24
(Received via mailing list)

Author.find(:all, :conditions => {:username => @username })
replace :all, for :first if needed.

Zach I.
→ Blog —
→ Company —
→ Portfolio —
This topic is locked and can not be replied to.