# File lib/generators/hobo/migration/migrator.rb, line 35 def primary_key false end
# File lib/generators/hobo/migration/migrator.rb, line 7 def self.from_reflection(refl) result = self.new result.join_table = refl.options[:join_table].to_s result.foreign_keys = [refl.foreign_key.to_s, refl.association_foreign_key.to_s].sort # this may fail in weird ways if HABTM is running across two DB connections (assuming that's even supported) # figure that anybody who sets THAT up can deal with their own migrations... result.connection = refl.active_record.connection result end
# File lib/generators/hobo/migration/migrator.rb, line 25 def field_specs i = 0 foreign_keys.inject({}) do |h, v| # some trickery to avoid an infinite loop when FieldSpec#initialize tries to call model.field_specs h[v] = HoboFields::Model::FieldSpec.new(self, v, :integer, :position => i) i += 1 h end end
# File lib/generators/hobo/migration/migrator.rb, line 39 def index_specs [] end
# File lib/generators/hobo/migration/migrator.rb, line 35 def primary_key false end
# File lib/generators/hobo/migration/migrator.rb, line 21 def table_exists? ActiveRecord::Migration.table_exists? table_name end
# File lib/generators/hobo/migration/migrator.rb, line 17 def table_name self.join_table end