> OK, but did you take heed of my warning in my first reply?  Can you
> guarantee that a user will always have a company (even in unusual
> circumstances)?  Add into your automated tests one where the user does
> not have a company and see what happens.  (Hint, find returns nil if
> it cannot find what you are asking for).

Every time an user is created, the account_id is recorded on its row 
too. But sure it's good to have a safety net.

> Another point, it might be worth providing a method somewhere called
> current_user (possibly in application_controller) that does the find,
> then you will not need to keep typing the find everywhere you want
> current_user.

Aight! DRYer and DRYer

-- 
Posted via http://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