[LRUG] Multiple databases, migration, integration...

Andrew Stewart boss at airbladesoftware.com
Fri Jan 8 03:57:51 PST 2010


On 8 Jan 2010, at 11:52, Riccardo Tacconi wrote:
> If I use :table_name_prefix => "rails_" I suppose that a table  
> rails_teams will be defined in Rails as teams, isn't it? Otherwise I  
> cannot see the utility.

That's right.  In your config/environment.rb you would add:

     config.active_record.table_name_prefix = 'rails_'

Then your Team model would map to the table rails_teams.  Once the  
prefix is configured you forget all about it in your code.  For  
example, if you wanted to add a column later on via a migration, you  
would do:

     add_column :teams, :name, :string

...and not `add_column :rails_teams ...`

Regards,

Andy Stewart
-------
http://airbladesoftware.com




More information about the Chat mailing list