How to access atributes from a join table?

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?

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 T.

http://blog.inlet-media.de

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs