Newbie Q: how do I implement using ActiveRecord?


I have a class, say called Customer, which has the following two
members (instance variables), CoreControls and OptionalControls.

Both CoreControls and OptionalControls are of the type
PropertyCollection, where PropertyCollection represents an array of a
composite data type.

I would be grateful for suggestion on how I might implement this from a
database and model perspective?


I ended up adding two ‘belongs_to’ declarations to my Customer class
and this did the trick.

belongs_to :optionalControls
:class_name => “PropertyControlCollection”,
:foreign_key => “optional_control_id”

belongs_to :coreControls
:class_name => “PropertyControlCollection”,
:foreign_key => “core_control_id”

plus of course the foreign keys to my “customers” table.

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