instance method
references
Ruby on Rails 4.1.16
Since v2.2.3Signature
references(*args)
No documentation comment.
Parameters
-
argsrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 254
def references(*args)
options = args.extract_options!
polymorphic = options.delete(:polymorphic)
index_options = options.delete(:index)
args.each do |col|
column("#{col}_id", :integer, options)
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) if polymorphic
index(polymorphic ? %w(id type).map { |t| "#{col}_#{t}" } : "#{col}_id", index_options.is_a?(Hash) ? index_options : {}) if index_options
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 254
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::TableDefinition