开发者

Getting a undefined method `validates_presence_of' for for a custom attr_accessor

开发者 https://www.devze.com 2023-02-08 04:42 出处:网络
I think the trouble is coming from the fact this is a custom Model. Error: undefined method `validates_presence_of\' for Calculation:Class

I think the trouble is coming from the fact this is a custom Model.

Error:

undefined method `validates_presence_of' for Calculation:Class

My Model:

class Calculation
  extend ActiveModel::Naming
  include ActiveModel::Conversion

  def persisted?
    false
  end

  attr_accessor :name, :docket_num, :payments, :our_file_num,
                :date_awarded, :date_paid, :amount_paid, :judgement_balance,
                :results, :total_interest, :per_diem, :lda

  validates_presence_of :date_awarded, :docket_num, :judgement_balance

Possibly there is something I need to include or extend to get Rails validations? The project is within a rails project, but I constructed the model by 开发者_StackOverflowhand.

Any ideas?


try including ActiveModel::Validations.

For more info checkout the documentation on it

0

精彩评论

暂无评论...
验证码 换一张
取 消