On Tuesday, May 7, 2013 4:12:21 PM UTC+1, Ruby-Forum.com User wrote:
>
> ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] 
> Rails 3.2.13 
>
> I have a validates ... :uniqueness constraint on one of the attributes 
> of an ActiveRecord class. 
>
> In my test suite, I set the attribute from the same attribute in a 
> record in the fixture. I then send invalid? to the object under test. 
> invalid? returns _false_, and the .errors object for the record shows no 
> errors. 
>
> A :uniqueness constraint on another attribute does invalidate the 
> record. All validations on other attributes behave as expected. 
>
> I've done what I could to search the Rails docs, Google, Stack Overflow, 
> and this forum for similar problems, and found nothing. 
>
> What's wrong? 
>
>
The object you're trying to edit/save is still pointing to the same row in 
the database - it's trying to update the existing row, not create a new row 
with the same tracking code

Fred

>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/GgdPE8DZM7sJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to