Hi everyone,
i have 20 fields in users table.
in my admin profile module the admin can modify his infomation.
but only 12 fields he can able to modify.
so in my controller
Because update_attribute ignores validations completely. The intent is
that it is useful when just changing an attribute (eg flipping a flag)
where you don't really care about the overall validity of the object.
update_attribute: Updates a single attribute and saves the record
without going through the normal validation procedure.
I expect if you're calling update_attribute 12 times you're doing
something wrong; either call update_attributes with a hash, or set
each attribute individually:
Hi..
thanks for the reply...
i have below validation in my model...
validates_exclusion_of :login,
:in => %w( admin ),
:message => "Name admin is not allowed"
it validates tat the admin should not be used as login name..
in my admin profile module the admin can modify his infomation.
when i save the instance of admin it gives me the above validation error
...
is it possible to skip the exclusion of validation when i update the
admin record....
Hi..
thanks for the reply...
i have below validation in my model...
validates_exclusion_of :login,
:in => %w( admin ),
:message => "Name admin is not allowed"
it validates tat the admin should not be used as login name..
in my admin profile module the admin can modify his infomation.
when i save the instance of admin it gives me the above validation
error
...
is it possible to skip the exclusion of validation when i update the
admin record....
Just don't use update_attribute. Use save, update_attributes etc.