Sql query in active record

hi all,

if i want to write a query select * from a,b where a.b_id=b.id in
active
record
using joins,condition how can i write that

in docs i found for conditions you do by giving “?” and then the
parameter
eg. a.b_id=?
but it takes b.id as string i.e a.b_id=‘b.id’
i dont want that

any suggestions

thanks in advance

regards
gaurav

gaurav bagga wrote:

hi all,

if i want to write a query select * from a,b where a.b_id=b.id in
active
record
using joins,condition how can i write that

in docs i found for conditions you do by giving “?” and then the
parameter
eg. a.b_id=?
but it takes b.id as string i.e a.b_id=‘b.id’
i dont want that

any suggestions

thanks in advance

regards
gaurav

You create a ‘a’ model, a ‘b’ model
and then
you add a belongs_to b in your model definition

hi,

i have that in my model files

regards
gaurav

On 10/6/06, nuno [email protected] wrote:

gaurav bagga wrote:

hi all,

if i want to write a query select * from a,b where a.b_id=b.id in
active
record
using joins,condition how can i write that

>   in docs i found for conditions you do by giving "?" and then the