Adam,

When we run centos, it only has ruby 1.8.5.  And [].count is not defined.

But unsure why heroku would fail on this - thought they were running 1.8.7 (or 
newer depending upon your stack)

Maybe monkey patching is your friend?

--Keenan

On May 10, 2010, at 10:37 PM, adam wrote:

> My heroku app is tripping over code at the point where i try to do a
> count on an empty array. But in development on my local machine with
> the very same database and code (taps db:pull) it doesnt trip up.
> 
> can anyone tell me why this is? im using ruby 1.8.7 and rails 2.3.2
> 
> below is the offending line which produces the error NoMethodError
> (undefined method `count' for []:Array):
> 
> 
> @recently_checked_sentences_count =
> @user.checked_sentences_since_last_login.count
> 
> with method below
> 
> def checked_sentences_since_last_login()
>    self.sentences.checked.find(:all, :conditions => ["checked_at
>> ?", last_login_at])
>  end
> 
> which uses named_scope
> 
> named_scope :checked,  lambda{|limit| { :limit => limit, :order =>
> "checked_at DESC", :conditions => "checked_at IS NOT NULL" } }
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Heroku" 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/heroku?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" 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/heroku?hl=en.

Reply via email to