Forum: Ruby on Rails Why doesn't SQLite Database Browser see the changes I am making from console?

Posted by Fanta (Guest)
on 2012-12-01 21:23
(Received via mailing list)
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<http://ruby.railstutorial.org/book/ruby-on-rails-t... 
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>
Posted by Hassan Schroeder (Guest)
on 2012-12-01 21:46
(Received via mailing list)
On Sat, Dec 1, 2012 at 12:22 PM, Fanta <f.g.fanta@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.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Posted by Mohamed Wael Khobalatte (Guest)
on 2012-12-01 22:01
(Received via mailing list)
In sandbox mode, all your changes are rollbacked once you leave it.

On Sat, Dec 1, 2012 at 8:45 PM, Hassan Schroeder 
<hassan.schroeder@gmail.com
> wrote:

> http://about.me/hassanschroeder
>
>


--
Mohamed Wael Khobalatte
Posted by Fanta (Guest)
on 2012-12-02 14:25
(Received via mailing list)
Thanks. That did the trick.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.