I agree that table_name_prefix is probably your best bet but if you find yourself needing something more dynamic look at the set_table_name method. It (optionally) accepts a block whose return value is used to set the table name. Use this to compute a model's table name on-the-fly with minimal hassle. Also consider that nested AR models automatically prepend their parent's table name to their table name which sounds to me a lot like what you are trying to do. Maybe that's an option for your situation. Best of luck to you.
Matt On May 31, 7:28 pm, Michael Koziarski <[email protected]> wrote: > > Is there a model load hook or something like that ? > > There's not at present no, however for your case you could simply > override the definition of the method table_name_prefix to do what you > require for your particular subclasses. > > -- > Cheers > > Koz -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
