Continuing the discussion from Delete a user with rails - fails:
Hello,
After following fore mentioned instructions I can’t delete users neither with standard procedure from Docs»Console»Deleting Records.
I become the following message:
irb(main):123:0 ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "users" violates foreign key constraint "fk_rails_08966259e8" on table "schedulers") irb(main):124:0
DETAIL: Key (id)=(27) is still referenced from table “schedulers”.
irb(main):125:0 : DELETE FROM "users" WHERE "users"."id" = $1 irb(main):126:0
irb(main):115:0> Ticket.where(customer_id:27).pluck(:id)
irb(main):127:0 => [] irb(main):128:0
irb(main):116:0> Ticket.where(owner_id:27).pluck(:id)
irb(main):129:0 => [] irb(main):130:0
irb(main):117:0> Ticket.where(created_by_id:27).pluck(:id)
irb(main):131:0 => [] irb(main):132:0
irb(main):118:0> Ticket.where(updated_by_id:27).pluck(:id)
irb(main):133:0` => []