One Quick help needed !

Hello Friends !

from my script/console

I am getting channel blog feature as below

Channel.find(:first).blog

=> #<Blog id: 1, activated_at: nil, state: true, channel_id: 1, feature_id: 1, created_at: “2009-05-18 13:00:51”, updated_at: “2009-05-18 13:00:51”>

but i wanted to do something like

Channel.find(:first)[“blog”]

=> nil

and it should return blog object, but it is not the case…

anyone have any idea on this ???

Thanks ,

Sandip R~

You can only access column attributes this way not, associations.

http://railsapi.com/doc/rails-v2.3.2.1/classes/ActiveRecord/Base.html#M001055

Cheers, Nicholas

Solution

eval("hannel.find(:first).#{“blog”})

Solution eval("hannel.find(:first).#{“blog”})

Yuck. send would be much more appropriate here (if you have to)

Fred

Thanks, fred !