If there is a way I can validate single attribute in Rails?
Something like:
ac_object.valid?(attribute_name)
I'm gonna use it for AJAX validation of particular model fields. Moving these validations to the Javascript makes code really ugly.
You can implement your own method in your model. Something like this
def valid_attribute?(attribute_name)
self.valid?
self.errors[attribute_name].blank?
end
Or add it to ActiveRecord::Base