Friday, August 12, 2011

Re: [Rails] Re: Validates attributes that aren't even being changed

On 12 August 2011 16:32, Leonel *.* <lists@ruby-forum.com> 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 when you try to change the username, but then say that
>> there is not a field for username in the form.
>
> Well, I'm trying to change the FIRST_NAME (and other fields but for
> simplicity purposes let's just say it's only the first_name). I get
> validation errors for the USERNAME and there's NOT EVEN A FIELD FOR THE
> USERNAME in the form.

As I said in my previous post VALIDATIONS ARE NOTHING TO DO WITH DATA
IN FIELDS ON THE FORM (yes, I can shout too), so it doesn't make any
difference whether username is on the form or not, the validations are
still run on all fields that are being written. Perhaps you had
better read my previous mail again more carefully. Perhaps you were
shouting so loudly you could not hear what I was saying. There may be
other useful data in it that you missed.

If you are getting uniqueness errors when updating a record on a field
that you have not changed then that suggests that maybe you are trying
to create a new record rather than updating the existing one.

Colin

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate