I am trying to devise for the first time. I created a basic input / output system and tried to create some objects from the console and noticed something strange:
rails c
Loading development environment in sandbox (Rails 4.1.5)
Any modifications you make will be rolled back on exit
Frame number: 0/20
[1] » u = User.last
User Load (0.7ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
(pry) output error:
[2] » u
(pry) output error:
[3] » u.id
=> 5
Why does the console throw an error on my object? The same thing happens with User.last, etc.
Here is my diagram:
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
end
source
share