Rails HABTM records

Sachin Joshi
Wed, 06 Apr 2011 03:56:15 -0000

Hello Experts,
I have a HABTM association between User and Account model through a
table users_accounts
the association seems to be working fine, e.g.
when i do

@user.account
it fetches the associated record which is just one record as of now.
@user.account
=> [#<Account id: 1, acc_name: "test account", created_at:
"2011-03-16
10:39:03", updated_at: "2011-04-03 01:58:03">]

When i use @user.account.acc_name in the view, it throws the following
error.

undefined method `acc_name'' for #<Class:0x317e6b0>

I am using rails 3.0.xx any help appreciated.

Thanks in Advance
Sachin

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org