Find_by

hi,
I have to retrieve data from table with two conditions using a actully
the following query

select * from abc where id=1 and type = ‘a’

how will i do if:

find_by_id(id) >>>>> how will i use for multiple conditions

On 15 March 2010 10:47, M I R [email protected] wrote:

select * from abc where id=1 and type = ‘a’

how will i do if:

find_by_id(id) >>>>> how will i use for multiple conditions

Model.all(:conditions => [“id = ? AND type = ?”, id, type])

i have already did in this method i was looking for a function like
that.
Thanks.

find_by_xxx_and_yyy_and_zzz (with as many conditions as you want)
how will i put the values against xxx, yyy and zzz,
i am new to rails so please give me an explicit example.

On Mar 15, 4:06 pm, Frederick C. [email protected]

On Mar 15, 10:47 am, M I R [email protected] wrote:

hi,
I have to retrieve data from table with two conditions using a actully
the following query

select * from abc where id=1 and type = ‘a’

how will i do if:

find_by_id(id) >>>>> how will i use for multiple conditions

you can do find_by_xxx_and_yyy_and_zzz (with as many conditions as you
want)

Fred

On Mon, Mar 15, 2010 at 4:17 PM, M I R [email protected] wrote:


You received this message because you are subscribed to the Google G.
“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][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Hello dear please check it this :

Abc.find(:all, :conditions => “id = 1” && “type = a”, :order => “created_on
DESC”)

thanks : Surender Pal Pareek

On Mar 15, 11:20 am, M I R [email protected] wrote:

find_by_xxx_and_yyy_and_zzz (with as many conditions as you want)
how will i put the values against xxx, yyy and zzz,
i am new to rails so please give me an explicit example.

There are some examples on

Fred