I’m having some trouble with the count method on AR objects. Here is
a stack trace:
t.subscriptions.count
ArgumentError: wrong number of arguments (2 for 3)
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/
lib/active_record/calculations.rb:160:inadd_limit!' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/ lib/active_record/calculations.rb:160:in
construct_calculation_sql’
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/
lib/active_record/calculations.rb:165:inexecute_simple_calculation' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/ lib/active_record/calculations.rb:144:in
calculate’
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/
lib/active_record/calculations.rb:66:incount' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/ lib/active_record/associations/has_many_association.rb:47:in
count’
from (irb):3
The error seems pretty weird, given that add_limit! seems to take 3
parameters where it’s defined, but the third has a default value and
is thus optional. What’s going on here?
Thanks,
Martin