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
Tutorialhttp://ruby.railstutorial.org/book/ruby-on-rails-tutorialI
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 R.”
=> #<User id: nil, name: “Mario R.”, 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 R.”], [“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 R.”, created_at: “2012-12-01
20:18:35”,
updated_at: “2012-12-01 20:18:35”>
irb(main):004:0>