Make the table "prefix" an attribute of a Stuff record.
In other words, keep the Stuff table. Add a StuffType field, or
something like that. If people "need" to see a StuffType_Stuff table
(i.e., bn_Stuff), create views or whatever to select just that set of
records of StuffType = ''bn''.
With simple views (no joins), these should still be updatable.
With Postgres and Oracle (and sql server 2000), if you have a complex
view that needs to be updatable like a table would be, on the
back-end, create an Instead Of trigger to push data into the right
places.
But, of course, this pisses just about every OO developer, who seem to
pretty much hate RDBMSes, because it''s "not OO". Oh well. It
is, but
only in the fixed OO design that is SQL.
Either way, you still have to do the same kind of coding. Whether you
want to put some of it in the RDB or not is up to you.
On Tue, 29 Mar 2005 18:32:01 +0200, Michel Valdrighi
<michelv-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> hello,
>
> I have just started developping stuff in Rails, and one project at the
> moment relies on making it possible for the user to add a prefix to
> the table names. So for example, "stuff" could be
"bn_stuff", but the
> object would still be a "stuff".
>
> Now, since ActiveRecord needs to store table1_id and table2_id in
> relationship tables, I wonder how I can make my app support table
> prefixes without having these prefixes show up in the relationship
> tables.
>
> Is that only possible?
> Or should I make the app''s installer create adhoc, not really
portable
> relationship tables that bear the prefix in the field names?
>
> Thanks in advance for any hint on this,
>
> --
> Michel Valdrighi
> Devéloppeur Web Intraordinaire
> http://zengun.org/weblog/
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>