Forum: Ruby on Rails How to access atributes from a join table?

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.
Bd3a9ca8a116e0055e65dd2d6069c946?d=identicon&s=25 Todd S. (tdog)
on 2006-03-19 18:06
I have a table "domains", "users" and a join table of "domains_users"
which has the domain_id, user_id as well as a userlevel_id attribute.

I know that in the model User class I can set the value of this
attribute with a function that calls:
domains.push_with_attributes(domain, :userlevel => 1)

but how do I access the userlevel field so that I can use it later on?
Bf66e10c8fc4abefebde0425e7f6f15a?d=identicon&s=25 Norman Timmler (Guest)
on 2006-03-20 10:35
(Received via mailing list)
Am Sonntag, den 19.03.2006, 18:06 +0100 schrieb Todd S.:
> I have a table "domains", "users" and a join table of "domains_users"
> which has the domain_id, user_id as well as a userlevel_id attribute.
>
> I know that in the model User class I can set the value of this
> attribute with a function that calls:
> domains.push_with_attributes(domain, :userlevel => 1)
>
> but how do I access the userlevel field so that I can use it later on?

Whenever you load related objects through the association accessor
methods like e.g. @domain.users, the join attributes are available in
the returned objects.

--
Norman Timmler

http://blog.inlet-media.de
This topic is locked and can not be replied to.