# Prototype/Virgin objects =\> usable objects, aka default db r

**URL:** <https://www.ruby-forum.com/t/prototype-virgin-objects-usable-objects-aka-default-db-r/89372>\
**Category:** Rails\
**Created:** [March 19, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/prototype-virgin-objects-usable-objects-aka-default-db-r/89372 "2007-03-19T23:32:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nemo](https://www.ruby-forum.com/u/nemo)\
**Post date:** [March 19, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/prototype-virgin-objects-usable-objects-aka-default-db-r/89372/1 "2007-03-19T23:32:14Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![nemo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nemo](https://www.ruby-forum.com/u/nemo)\
**Post date:** [March 20, 2007, 10:07pm UTC](https://www.ruby-forum.com/t/prototype-virgin-objects-usable-objects-aka-default-db-r/89372/2 "2007-03-20T22:07:49Z")

</div>

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? 🙂
