I am adding records to a table from a console started with the --sandbox option. From console I can see the changes have been saved, but still the SQLite Database browser shows me an empty table. What am I doing wrong?
Following the Ruby on Rails Tutorial I have done the migration to create the table, both in development and test environment, then added a record to it from the console, but it doesn't show up in SQLite Database browser. Here the console transcript that makes me believe the new record has been added. What can I do to see the newly added record from the Database browser?
Thanks!
>rails console --sandbox
Loading development environment in sandbox (Rails 3.2.9)
Any modifications you make will be rolled back on exit
irb(main):001:0> user= User.new name: "Mario Rossi"
=> #<User id: nil, name: "Mario Rossi", created_at: nil, updated_at: nil>
irb(main):002:0> user.save
←[1m←[35m (0.0ms)←[0m SAVEPOINT active_record_1
←[1m←[36mSQL (66.0ms)←[0m ←[1mINSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?)←[0m [["created_at", Sat, 01 Dec 2012 20:18:35 UTC +00:00], ["name", "Mario Rossi"], ["update
d_at", Sat, 01 Dec 2012 20:18:35 UTC +00:00]]
←[1m←[35m (0.0ms)←[0m RELEASE SAVEPOINT active_record_1
=> true
irb(main):003:0> User.find(1)
←[1m←[36mUser Load (0.0ms)←[0m ←[1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1←[0m [["id", 1]]
=> #<User id: 1, name: "Mario Rossi", created_at: "2012-12-01 20:18:35", updated_at: "2012-12-01 20:18:35">
irb(main):004:0>
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/l1L_QIX3_jQJ.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment