Why would this not be working?
class Customer < ActiveRecord::Base
has_many :notes, :class_name => "CustomerNote", :foreign_key => 'customer_id'
def self.called_this_month
self.notes.where(:date => Date.today.beginning_of_month..Date.today.end_of_month).count
end
end
I get this error:
undefined method `notes` for #<Class:0x00000004b37190>
Note Model:
class CustomerNote < ActiveRecord::Base
self.table_name = "customer_contact"
belongs_to :customer
end
self.called_this_monthreally be this:called_this_month- Sam Peaceyundefined method 'called_this_month'- andynotesis going to be on an instance of Customer where you're defining called_this_month on the Customer class itself - Sam Peacey