Matt Jones wrote in post #1154197:
On Saturday, 2 August 2014 11:41:46 UTC-4, Ruby-Forum.com User wrote:
method.
because I often have the case that I will update only some of the
attributes. I wonder *why* validates looks at attributes which are not
part of the update. Is there a use case
Jason Fb wrote in post #1154202:
validates :password, if: lambda { self.registration_state ==
registered }
This is an interesting idea. In my case, user attributes change after
creation only if the user updates his profile, or when he clicks on the
forgot my password link and I have to create
On Saturday, 2 August 2014 11:41:46 UTC-4, Ruby-Forum.com User wrote:
Eric Saupe wrote in post #1154001:
First change the validates to only validate if a
password is being passed.
validates :password, length: { minimum: 6 }, :if = :password
Second, remove the parameters
Eric Saupe wrote in post #1154001:
First change the validates to only validate if a
password is being passed.
validates :password, length: { minimum: 6 }, :if = :password
Second, remove the parameters for password if the are blank on your
update
method.
if params[:password].blank?
I had this same problem a while ago. The issue comes in the
update_attributes since it wants to update all of the attributes that are
being passed to it, which is including an empty password. To fix it you'll
need to do two things. First change the validates to only validate if a
password is
5 matches
Mail list logo