validation - Rails ActiveRecord: validate single attribute -
if there way can validate single attribute in rails?
something like:
ac_object.valid?(attribute_name)
i'm gonna use ajax validation of particular model fields. moving these validations javascript makes code ugly.
you can implement own method in model. this
def valid_attribute?(attribute_name) self.valid? self.errors[attribute_name].blank? end
or add activerecord::base
Comments
Post a Comment