For a model that has validations in the model_name.rb file, how can I access these checks manually? I would like to prepare my form validation system, which will work together with the Rails built-in tricks, and I want everything to be as dry as possible. My main problem is that I need to do a server-side check before any of the form values gets into the database (I use a multi-stage form).
Basically I am wondering if there is a way like
User.validations.each do |v|
puts v.constraint.to_s + " " + v.message
end
Is there anything similar?
Thanks in advance.
source
share