Thank you Fred ! Meanwhile I simply realized that I had to submit a new user with all attributes and not just 2 : > that was why the validation did not work and the transaction was rolled back.
Thanks for the user2.errors hint... Francesco On Friday, May 25, 2012 10:16:59 AM UTC+2, Frederick Cheung wrote: > > > > On May 24, 2:58 pm, Francesco De Grandi <fdgar...@gmail.com> wrote: > > At the end of Rails Tutorial chapter 6, I have the > > development .sqlite3 db : 1 table and 1 row (= user id:1 see below) : > > > > > when running from the Rails Concole Sandbox, to create other > rows/records, I can not save or create > > > here is what I get - Rollback - without even exiting the Rail Console > ! ! ! > > > it is like if an exception is raised somehow > > > > Sounds like you've got a failing validation - user2.errors will tell > you which validations (if any) have failed. > > Fred > > 1.9.3p125 :002 > user1 = User.first > > > > User Load (0.2ms) SELECT "users".* FROM "users" LIMIT 1 > > => #<User id: 1, name: "Michael Hartl", email: "mha...@example.com", > > created_at: "2012-05-22 10:32:16", updated_at: "2012-05-22 10:32:16", > > password_digest: "$2a > > $10$Eh2xj8CvvKaDFD2uel4LbOQ2dMsCmENy8tyts1BsFzJb..."> > > > > 1.9.3p125 :002 > user2 = User.create(name: "Francois DG", email: > > "f...@example.com") > > > > (0.1ms) SAVEPOINT active_record_1 > > User Exists (0.2ms) SELECT 1 FROM "users" WHERE > > LOWER("users"."email") = LOWER('...@example.com') LIMIT 1 > > (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 > > => #<User id: nil, name: "Francois DG", email: "f...@example.com", > > created_at: nil, updated_at: nil, password_digest: nil> > > > > CAN SOMEBODY TELL ME WHY & WHAT TO DO ? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sjEJmNQSw-UJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.