Forum: Ruby on Rails Initializing aggregated structures

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5233478c51a92b6a1a5c970cbf3a42f3?d=identicon&s=25 Isak Hansen (Guest)
on 2006-05-23 11:36
(Received via mailing list)
I have a model, Vendor, which belongs_to :account, :visiting_address.
(1..1 for both)

Now, to 'prevent redundancy'/inconsistencies, the Vendor model doesn't
have a name attribute, but instead stores it's name in
(Should probably be the other way around, but that's messier)

My controller goes something like this:

@vendor = => whatever)

While vendor has the following methods:

  def initialize(*args)  # param look reasonable, btw? seems to be
working atm, but..
    self.account ||=
    self.visiting_address ||=

  def name=(name)
    self.account ||= = name

Not the best way to go around this, I'm sure...? Suggestions?
This topic is locked and can not be replied to.