为什么这不起作用?
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
我收到此错误:
undefined method `notes` for #<Class:0x00000004b37190>
备注型号:
class CustomerNote < ActiveRecord::Base
self.table_name = "customer_contact"
belongs_to :customer
end