Module: BigintPrimarykey::DefaultBigintForeignKeyReferences
- Defined in:
- lib/bigint_primarykey.rb
Instance Method Summary collapse
Instance Method Details
#references(*args) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bigint_primarykey.rb', line 36 def references(*args) = args. .reverse_merge! limit: 8 # Limit shouldn't affect "#{col}_type" column in polymorphic reference. # But don't change value if it isn't simple 'true'. # Examples: # t.references :subject, null: false, polymorphic: true ==> t.integer :subject_id, limit: 8, null: false # t.string :subject_type, null: false # t.references :subject, polymorphic: { limit: 120 } ==> t.integer :subject_id, limit: 8 # t.string :subject_type, limit: 120 [:polymorphic] = .except(:polymorphic, :limit) if [:polymorphic] == true super(*args, ) end |