Forum: Ruby on Rails Get an attrifutes from joins in a find method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
39a8b48aca70346605c630851d1aee3a?d=identicon&s=25 Luca Roma (romaluca)
on 2008-12-11 18:54
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
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2008-12-12 00:25
(Received via mailing list)
Luca Roma 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
This topic is locked and can not be replied to.