Why doesn't SQLite Database Browser see the changes I am making from console?

111 views
Skip to first unread message

Fanta

unread,
Dec 1, 2012, 3:22:34 PM12/1/12
to rubyonra...@googlegroups.com
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>

Hassan Schroeder

unread,
Dec 1, 2012, 3:45:14 PM12/1/12
to rubyonra...@googlegroups.com
On Sat, Dec 1, 2012 at 12:22 PM, Fanta <f.g....@gmail.com> wrote:
> I am adding records to a table from a console started with the --sandbox
> option.

> What can I do to see the newly added record from the Database browser?

Don't use --sandbox :-)

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

Mohamed Wael Khobalatte

unread,
Dec 1, 2012, 4:00:40 PM12/1/12
to rubyonra...@googlegroups.com
In sandbox mode, all your changes are rollbacked once you leave it. 


--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.



--
Mohamed Wael Khobalatte


Fanta

unread,
Dec 2, 2012, 8:24:18 AM12/2/12
to rubyonra...@googlegroups.com
Thanks. That did the trick.
Reply all
Reply to author
Forward
0 new messages