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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -