I\'m trying to do a simple user.destroy but running into the following error:
ERROR: update or delete on table \"users\" violates foreig
An easy solution is to simply cascade-delete the records in the associated table, which can be done through active record, like so:
user.rb
class User < ActiveRecord::Base
has_many :identities, dependent: :destroy
# rest of user class
end
Check out the documentation pertaining to has_many for more info.