Class: ActiveRecord::ConnectionAdapters::Table
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::Table
- Defined in:
- lib/active_record_foreign_keys.rb
Instance Method Summary collapse
Instance Method Details
#references_with_foreign_key(*args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active_record_foreign_keys.rb', line 34 def references_with_foreign_key(*args) = args. cols = args.dup = .delete(:foreign_key) || false references_without_foreign_key(*(args << )) unless [:polymorphic] || == false = {} unless .is_a?(Hash) cols.each { |col| @base.add_foreign_key(@table_name, "#{col}_id", col.to_s.pluralize, "id", ) } end end |