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

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.
nemo (Guest)
on 2007-03-20 00:32
(Received via mailing list)

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!
nemo (Guest)
on 2007-03-20 23: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.