instance method
remove_reference
Ruby on Rails 4.1.16
Since v4.0.13Signature
remove_reference(table_name, ref_name, options = {})
Removes the reference(s). Also removes a type column if one exists. remove_reference, remove_references and remove_belongs_to are acceptable.
Remove the reference
remove_reference(:products, :user, index: true)
Remove polymorphic reference
remove_reference(:products, :supplier, polymorphic: true)
Parameters
-
table_namereq -
ref_namereq -
optionsopt = {}
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 639
def remove_reference(table_name, ref_name, options = {})
remove_column(table_name, "#{ref_name}_id")
remove_column(table_name, "#{ref_name}_type") if options[:polymorphic]
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 639
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements