Wednesday, May 28, 2008

depends_on update(2)

This update allows for non-polymorphic associations. For instance a user belongs_to a profile. To define this association add the following to the User model:
depends_on :profile, :attrs => [:first_name, :last_name, :email]
Notice an ":as" option has not been passed because this isn't a polymorphic association. So instead of adding the has_one call, a belongs_to reference is added.

The original post has the updated code.

Getting time to put this into a gem...

0 comments: