Ruby on rails ActiveRecord-如何使用'around_验证`
我正试图绕过_验证来使用Rails/AR3.1.3,但没有成功。 如果我没有错,根据 它应该通过在模型中定义方法来工作:Ruby on rails ActiveRecord-如何使用'around_验证`,ruby-on-rails,validation,activerecord,Ruby On Rails,Validation,Activerecord,我正试图绕过_验证来使用Rails/AR3.1.3,但没有成功。 如果我没有错,根据 它应该通过在模型中定义方法来工作: class User < ActiveRecord::Base def around_validation puts "jo!" yield end end 但什么都不会被执行:-我做错了什么?谢谢 好的,我自己想出来的: 不存在“周围”验证。而是覆盖受保护的运行验证 ->Rails 3没有回调:around\u验证。所以你的方法没有被调用。你
class User < ActiveRecord::Base
def around_validation
puts "jo!"
yield
end
end
但什么都不会被执行:-我做错了什么?谢谢 好的,我自己想出来的: 不存在“周围”验证。而是覆盖受保护的运行验证 ->Rails 3没有回调:around\u验证。所以你的方法没有被调用。你想做什么