Module: ActiveRecord::ConnectionAdapters::SchemaStatements

Defined in:
lib/bagman/active_record.rb

Instance Method Summary collapse

Instance Method Details

#add_bag_indexes_for(table_name) ⇒ Object



41
42
43
# File 'lib/bagman/active_record.rb', line 41

def add_bag_indexes_for(table_name)
  Bagman::TableBuilder.add_indexes(self, table_name, bag_for_table(table_name.singularize.to_sym))
end

#bag_for_table(table) ⇒ Object



35
36
37
38
39
# File 'lib/bagman/active_record.rb', line 35

def bag_for_table(table)
  klass = table.to_s.classify.constantize
  raise "#{klass} doesn't have a bag" unless klass.respond_to?(:bag)
  klass.bag
end