On Jul 22, 9:56 am, Rob Gu <[email protected]> wrote:
> "User.first.id" returns "3", I guess I did some edit/deletes.
>
> "Micropost.first.user" returns "nil".
> "Micropost.first.user_id" returns "1" oddly enough.
>
> Interesting, but what I don't get, is "User.first" selects the first
> user (regardless of their id).  So "User.first.microposts" should give
> me the first user's microposts I would think, no?
>

If User.first.id is 3, then User.first.microposts will return the
microposts with user_id 3
It sounds like you used to have  a User with id 1, which you then
deleted, leaving an orphaned micropost with no user behind.

Fred


> I'm wondering if as I was going through this tutorial, maybe I screwed
> some things up?
>
> Thanks for the replies btw!
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to