Module: Goldberg::Model

Included in:
ContentPage, ControllerAction, MenuItem, Permission, Role, RolesPermission, SiteController, SystemSettings, User
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/model.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/model.rb', line 14

def self.included(base)
  base.class_eval do
    
    def self.prefix
      if not @prefix
        if ActiveRecord::ConnectionAdapters::const_defined?(:PostgreSQLAdapter) &&
            self.connection.class.to_s == 
            'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter'
          @prefix = 'goldberg.'
        else
          @prefix = 'goldberg_'
        end
      end
      @prefix
    end
    
    (table_name =~ /goldberg/) ||
      (set_table_name "#{self.prefix}#{self.table_name}")
  end
end