Today I Learned

hashrocket A Hashrocket project

Remove Belongs To Association

To remove a belongs_to association using the Rails migration DSL, use the remove_references method. This method is aliased to remove_reference and remove_belongs_to.

class RemoveTagReferences < ActiveRecord::Migration
  def change
    change_table :posts do |t|
      t.remove_references :tag
    end
  end
end
See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.