I'm getting these warnings:
payment_method.rb:11: warning: multiple values for a block parameter (0 for 1)
payment_method.rb:12: warning: multiple values for a block parameter (0 for 1)
payment_method.rb lines 11 and 12:
class PaymentMethod < ActiveRecord::Base
...
named_scope :expiring_next_month, lambda {|pm| {:conditions => {:ed => DateTime.now.beginning_of_month}}}
named_scope :expired, lambda {|pm| {:conditions => ["ed < ?", DateTime.now.beginning_of_month]}}
...
end
What am I missing here?
You have a params on your scope. You need use it. Or not define it
named_scope :expiring_next_month, lambda { {:conditions => {:ed => DateTime.now.beginning_of_month}}}
named_scope :expired, lambda { {:conditions => ["ed < ?", DateTime.now.beginning_of_month]}}
With my case you can call without args. Not in your case. In ruby 1.8 there are no way to have optionnal params in lambda.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With