Module: ActiveRecord::ConnectionAdapters::SchemaStatements
- Defined in:
- lib/friendly_fk.rb
Instance Method Summary collapse
- #foreign_key_name(from_table, options) ⇒ Object
-
#foreign_key_options(from_table, to_table, options) ⇒ Object
:nodoc:.
Instance Method Details
#foreign_key_name(from_table, options) ⇒ Object
16 17 18 19 20 |
# File 'lib/friendly_fk.rb', line 16 def foreign_key_name(from_table, ) .fetch(:name) do "fk_#{from_table}__#{[:to_table]}" end end |
#foreign_key_options(from_table, to_table, options) ⇒ Object
:nodoc:
8 9 10 11 12 13 14 |
# File 'lib/friendly_fk.rb', line 8 def (from_table, to_table, ) # :nodoc: = .dup [:to_table] = to_table [:column] ||= foreign_key_column_for(to_table) [:name] ||= foreign_key_name(from_table, ) end |