Topic: Rails 3 Plugin - Active Record table_name_prefix

Im having problem to use table_name_prefix on my projects. I have a main apllication in my project that have others applications as plugins, these plugins works like a subsystem from the main application.

To organize the tables on database of the subsystems I would like to use the table_name_prefix of the ActiveRecord Plugin.

If I put on init.rb of plugin the command config.active_record.table_name_prefix = "per_" the main application will not work because the ActiveRecord will try to find for "per_users" but the only thing I want is that only the Plugin on my main application use the prefix "per_".

I tried to create a rails folder at my plugin with the command above but the same problem occurs, all the application try to find for prefixed table name.

An alternative is use the set_table_name in the model of plugin, but its not good for me because Im developing subsystems as rails plugin and I dont want to change the models when put the subsystem at the main application.

Someone can help me?

Last edited by renatocdesouza (2011-08-11 10:09:55)