Leonel *.* wrote in post #1017341:
> I temporarily solved the username attribute by not letting the user
> update the username. So the validation only works :on => :create
> So username attribute validation problem solved.
>
> Now I got the password validation problem. Ok, it seems the problem was
Try this
:unless => Proc.new {|user| user.password.nil?}
Essentially it will check if you are sending a password attribute to the
user or not while updating the user record and will check for this
validation only if password attribute is present.
Chirag
http://sumeruonrails.com
On Thu, Aug
Can someone help me complete this piece of code?
I'm thinking about using :unless because the only place where I wouldn't
like the password validation is in the Edit User page.
validates :password,
:presence => true,
:length => { :minimum => 6, :maximum => 20, :message => 'should have
between 6
I temporarily solved the username attribute by not letting the user
update the username. So the validation only works :on => :create
So username attribute validation problem solved.
Now I got the password validation problem. Ok, it seems the problem was
kinda of obvious but I couldn't see it.
I
On 12 August 2011 16:32, Leonel *.* wrote:
> Thanks to everybody for their comments, it's helping me understand Rails
> more :)
>
> I'm going to try your suggestions.
>
>> Colin Law wrote in post #1016307:
>> Having said that I do not understand your comment above, you say you
>> get the problem w
Thanks to everybody for their comments, it's helping me understand Rails
more :)
I'm going to try your suggestions.
> Colin Law wrote in post #1016307:
> Having said that I do not understand your comment above, you say you
> get the problem when you try to change the username, but then say that
On Thu, Aug 11, 2011 at 4:02 PM, Leonel *.* wrote:
> Well yeah but even if I take :on => :update away it'll still run the
> validation, right?
Easiest way to find out is to try it :-)
> I've read that Rails runs the validation on "update" and "save" unless
> you specify otherwise.
If so, then
Well yeah but even if I take :on => :update away it'll still run the
validation, right?
I've read that Rails runs the validation on "update" and "save" unless
you specify otherwise.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Googl
8 matches
Mail list logo