Get an attrifutes from joins in a find method


#1

I have wrote an example:

example=Example.find(:all,:joins=>"(select id,“hello” as hello_name from
examples2) as examples3 where examples3.id=examples.id")

I want get the attribute hello_name that not exits in db.
example[0].hello_word not works
example[0].example3.hello_name not works
how can i do?
thanks


#2

Luca R. wrote:

I have wrote an example:

example=Example.find(:all,:joins=>"(select id,“hello” as hello_name from
examples2) as examples3 where examples3.id=examples.id")

I want get the attribute hello_name that not exits in db.
example[0].hello_word not works
example[0].example3.hello_name not works

Try example[0][:hello_word]


Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com