I occasionally forget that I deleted some record and am puzzled why something 
isn't working. I am using MySQL and I find that it's helpful to have an easy 
way to look at the specifics of what's in the database so I keep SequelPro 
(<http://www.sequelpro.com/>) running. Then I can see what the PK and FK values 
are at a glance ("yes, I did delete User with ID=1", for example). It also 
makes it easy to create test records quickly while I'm working out various 
algorithms.

**Leigh

>
>
>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