In my example, I only saw the wishlist by asking for it. I was testing
in console, and I called User.create! with parameters, and when that
saved, I did not see anything about the wishlist being created in the
console output.
In the next line I used a trick – underscore picks up the return value
from the previous line in Rails console. So I called _.wishlist to find
out if the new User had a wishlist. What do you see when you ask for
Wishlist.all in console?
I’ll try running it again in rails server and see if the server log
indicates the wishlist is being created.
Apparently so:
Started GET “/users/sign_up” for 127.0.0.1 at Fri Feb 10 15:20:48 -0500
2012
Processing by Devise::RegistrationsController#new as HTML
Rendered
/Users/waltd/.rvm/gems/ruby-1.8.7-p352/gems/devise-1.5.3/app/views/devise/shared/_links.erb
(1.4ms)
Rendered
/Users/waltd/.rvm/gems/ruby-1.8.7-p352/gems/devise-1.5.3/app/views/devise/registrations/new.html.erb
within layouts/application (20.1ms)
Completed 200 OK in 47ms (Views: 44.8ms | ActiveRecord: 0.0ms)
Started POST “/users” for 127.0.0.1 at Fri Feb 10 15:21:02 -0500 2012
Processing by Devise::RegistrationsController#create as HTML
Parameters: {“commit”=>“Sign up”,
“authenticity_token”=>“IezLEQXCXqvMaJRaIIURbzNJWp5CU6YPx8/prrrrS9Q=”,
“utf8”=>“✓”, “user”=>{“password_confirmation”=>“[FILTERED]”,
“password”=>“[FILTERED]”, “email”=>“[email protected]”}}
SQL (0.2ms) SELECT 1 FROM “users” WHERE (“users”.“email” =
‘[email protected]’) LIMIT 1
SQL (0.1ms) SELECT name
FROM sqlite_master
WHERE type = ‘table’ AND NOT name = ‘sqlite_sequence’
AREL (0.4ms) INSERT INTO “wishlists” (“updated_at”, “user_id”,
“created_at”) VALUES (‘2012-02-10 20:21:02.788524’, NULL, ‘2012-02-10
20:21:02.788524’)
AREL (0.2ms) INSERT INTO “users” (“current_sign_in_at”,
“last_sign_in_at”, “last_sign_in_ip”, “encrypted_password”, “email”,
“sign_in_count”, “current_sign_in_ip”, “remember_created_at”, “name”,
“reset_password_sent_at”, “reset_password_token”, “updated_at”,
“created_at”) VALUES (NULL, NULL, NULL,
‘$2a$10$v6bk7ld4W5MG4F0H91vpregCN/xF0P.gwyM9tfH4tQ/H8zAMU3i4a’,
‘[email protected]’, 0, NULL, NULL, NULL, NULL, NULL, ‘2012-02-10
20:21:02.822993’, ‘2012-02-10 20:21:02.822993’)
AREL (0.1ms) UPDATE “wishlists” SET “updated_at” = ‘2012-02-10
20:21:02.825246’, “user_id” = 6 WHERE “wishlists”.“id” = 5
AREL (0.2ms) UPDATE “users” SET “current_sign_in_at” = ‘2012-02-10
20:21:02.827881’, “last_sign_in_at” = ‘2012-02-10 20:21:02.827881’,
“last_sign_in_ip” = ‘127.0.0.1’, “sign_in_count” = 1,
“current_sign_in_ip” = ‘127.0.0.1’, “updated_at” = ‘2012-02-10
20:21:02.828227’ WHERE “users”.“id” = 6
Redirected to http://localhost:3000/
Completed 302 Found in 268ms
You’re going to have to show me your models if I’m going to be of any
further help to you here.
Walter