Search code examples
ruby-on-railsprefix

Specify a table prefix for MySQL


In CakePHP, I can specify a prefix in my database configuration, i.e. "so_", so that every model looks for its table under this prefix.

Is something similar possible in Rails, too? That is, can several programs share one database?


Solution

  • You might try the following in environments.rb: In the config section add the following code

    config.active_record.table_name_prefix = "so_"