What is the Rails3 version of errors.add_to_base?

前端 未结 4 1266
情话喂你
情话喂你 2021-02-03 19:46

I want to write a custom validation in Rails 3, but following this example I get:

\'ActiveModel::DeprecatedErrorMethods.add_to_base\' call is deprecated in Rails         


        
4条回答
  •  伪装坚强ぢ
    2021-02-03 20:13

    For me this "hack" worked best:

    instance.errors.add("", "Msg")
    

    When I tried to specify "base" as the first argument, the word base kept getting inserted into my validation messages.

提交回复
热议问题