I am trying to create a task by using attributes of the customer bill and given below are the
class Supplier < ActiveRecord::Base
has_many :tasks, :dependent => :destroy
after_update :updating_daily_job_task
def updating_daily_job_task
if self.amount.present? && self.date.present?
Task.create(:name => self.supplier_id.to_s, :due => self.date)
end
end
end
task model
class Task < ActiveRecord::Base
attr_accessible :name, :due, :complete, :user_id, :supplier_bill_id
belongs_to :supplier_bill, :foreign_key => "supplier_bill_id"
validates_presence_of :name, :due
end
and i am getting the following error
undefined method `create’ for Rake::Task:Class
can anyone tell me where i am doing anything wrong??? thanks in advance 🙂
You should change the class name for the
Taskmodel. Change it toSupplierTaskor anything more relavant. Task is used somewhere in Rails internals, which causes this issue.