Module: MigrationHelpers::Common
- Defined in:
- lib/migrate/common.rb
Instance Method Summary collapse
Instance Method Details
#table_name_for_item(resources, item) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/migrate/common.rb', line 43 def table_name_for_item(resources, item) engine = infer_engine_from_namespace resource = resources.to_s.singularize table_name = "#{resource}_#{item}".to_sym foreign_key = resource.sub("#{engine}_","") return [table_name, foreign_key] end |
#table_name_for_shared(engine, table_name) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/migrate/common.rb', line 36 def table_name_for_shared(engine, table_name) table_name = "#{engine}_#{table_name}".to_sym table_name_account = "#{engine}_accounts".to_sym return [table_name, table_name_account] end |