How to remove validation using instance_eval clause in Rails?

后端 未结 18 1837
情话喂你
情话喂你 2021-02-01 02:11

I would like to enhance existing class using instance_eval. There original definition contains validation, which require presence of certain fields, ie:

class Du         


        
18条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-01 02:45

    If you really want to do this then here would be a good place to start digging: https://github.com/rails/rails/blob/ed7614aa7de2eaeba16c9af11cf09b4fd7ed6819/activemodel/lib/active_model/validations/validates.rb#L82

    However, to be honest, inside of ActiveModel is not where I'd be poking with a stick.

提交回复
热议问题