Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irb(main):004:0> u = User.find(1)
- D, [2019-02-23T13:36:30.220872 #4] DEBUG -- : User Load (2.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
- => #<User id: 1, name: "Venya", username: "venik", created_at: "2019-02-20 09:14:18", updated_at: "2019-02-20 09:19:04", email: "venya@mail.ru", password_hash: "598b4f2620256a2e05304ff85d23dfc4f778a4ad8d2de0ac76...", password_salt: "823e00de5cb9c6d50d2baaf1d89d7108", avatar_url: "", headers_color: "#48537b">
- irb(main):005:0> u
- => #<User id: 1, name: "Venya", username: "venik", created_at: "2019-02-20 09:14:18", updated_at: "2019-02-20 09:19:04", email: "venya@mail.ru", password_hash: "598b4f2620256a2e05304ff85d23dfc4f778a4ad8d2de0ac76...", password_salt: "823e00de5cb9c6d50d2baaf1d89d7108", avatar_url: "", headers_color: "#48537b">
- irb(main):006:0> u.destroy
- D, [2019-02-23T13:36:37.092641 #4] DEBUG -- : (1.8ms) BEGIN
- D, [2019-02-23T13:36:37.096122 #4] DEBUG -- : User Destroy (2.9ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 1]]
- D, [2019-02-23T13:36:37.098032 #4] DEBUG -- : (1.7ms) ROLLBACK
- Traceback (most recent call last):
- 1: from (irb):6
- ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "users" violates foreign key constraint "fk_rails_047ab75908" on table "questions")
- DETAIL: Key (id)=(1) is still referenced from table "questions".
- : DELETE FROM "users" WHERE "users"."id" = $1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement