Forum: Ruby Migration with Dynamic Table Names?

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.
unknown (Guest)
on 2005-12-12 21:49
(Received via mailing list)
(This is my first real Ruby/Rails project, so please bare with me...)

I am working on a project that, effectively, has the following database
structure:

A master table:
  Projects
     - id
     - project_name
     - etc...

Many slave tables:
  <project_name>_data
      - id
      - data_field (several)

So, instead of having one "slave data" table, we have many tables.
There are a variety of historical and practical reasons for this that,
while a less than ideal db structure, is needed in this case.  Projects
will come and go, so new names will be created all of the time.

The slave tables will all have the same structure, so the same model
can be used (Slave_data, let's say).  I understand that I'll need to
use set_table_name - I'm just not sure *where* to use it.  I'm assuming
somewhere within the parent's model - but I'm a little iffy on the
details.

I guess they'll need to be something in or around the "has_many
:slave_data" type line?
James B. (Guest)
on 2005-12-12 22:46
(Received via mailing list)
removed_email_address@domain.invalid wrote:
> (This is my first real Ruby/Rails project, so please bare with me...)

You may have better luck on the Rails mailing list:

   http://lists.rubyonrails.org/mailman/listinfo/rails



James

--

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
This topic is locked and can not be replied to.