Forum: Ruby on Rails Prototype/Virgin objects => usable objects, aka default db r

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.
3880f04333bf8375b44cd6aa135406c7?d=identicon&s=25 nemo (Guest)
on 2007-03-19 23:32
(Received via mailing list)
Hellos,

I'm kinda stumped, so hopefully someone can help me out.

I have a custom_modules table, in which I've defined default modules
for a skinnable website I'm designing. Those modules have default
values, such as css class, position (left/right) and so on.

When a user registers with the site, he gets a fresh new Template
object, which has_many :custom_modules. However, these are the
"prototype", or virgin objects from my rows in that table. What I want
to do is make a copy of those for my newly instantiated template, so
the user can safely modify his *own* custom_modules.

Any ideas on how to achieve this?

thanks a bunch!
3880f04333bf8375b44cd6aa135406c7?d=identicon&s=25 nemo (Guest)
on 2007-03-20 22:07
(Received via mailing list)
Ok, after some more researching on the topic, I think I need to use
has_many :through.
Maybe stuff all the user specified changes in the join model, and keep
an link to the original module, and values, using the join itself. I
just can't get my head around implementing it. Can anyone spare a
minute? :)
This topic is locked and can not be replied to.