Commit bfccd16de6e8924e0d24e0b5f77ecb3ca77409fc

Authored by Braulio Bhavamitra
1 parent 50c2d5c8

Use table_prefix_name for plugins' table_name

This makes Noosfero::Plugin::ActiveRecord obsolete. With plugin
interdependency, self.inherited may get the table name from another
class.
Showing 1 changed file with 6 additions and 0 deletions   Show diff stats
lib/noosfero/plugin.rb
... ... @@ -12,6 +12,12 @@ class Noosfero::Plugin
12 12  
13 13 attr_writer :should_load
14 14  
  15 + # Called for each ActiveRecord class with parents
  16 + # See http://apidock.com/rails/ActiveRecord/ModelSchema/ClassMethods/full_table_name_prefix
  17 + def table_name_prefix
  18 + @table_name_prefix ||= "#{name.to_s.underscore}_"
  19 + end
  20 +
15 21 def should_load
16 22 @should_load.nil? && true || @boot
17 23 end
... ...