Vahagn Hayrapetyan wrote:

>     users.each do |user| #evaluates to nil.each - debug

In general, you need to cut your action up into tiny methods and write unit 
tests on each one. They incredibly reduce the odds of exactly this kind of 
drama! Then the methods should run in the model layer, and the controller 
should 
only call into the model.

Specifically, check if 'users' is aliased anywhere else, such as to a method. 
Then try this:

  (users || []).each

That will force a nil users to behave like an empty array. .find(:all) should 
naturally return an empty array if you have no users, so you should not need 
this tweak. But it lets you manually debug more:

   (users || (p 'still nil!'; []).each

-- 
   Phlip


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