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~


Ruby on Rails Developer

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

On 19 Jun 2009, at 17:08, Sandip R. wrote:

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

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

Fred

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

On Fri, Jun 19, 2009 at 7:31 PM, Nicholas H.
[email protected]wrote:

Hello Friends !

funonrails.wordpress.comwww.joshsoftware.com


Ruby on Rails Developer

Thanks, fred !