Ruby on Rails Saturday, September 4, 2010

On 4 September 2010 20:49, Pito Salas <lists@ruby-forum.com> wrote:
> Fernando Perez wrote:
>> !=
>
> Thanks... The reason I didn't think that is what it meant (although I
> believe you :) is that I saw it here:
>
> [Development]>> ap j
> #<DistrictSet:0x105568550> {
>                   :id => 3,
>         :display_name => "ds2",
>           :created_at => Sat, 04 Sep 2010 11:21:36 PDT -07:00,
>           :updated_at => Sat, 04 Sep 2010 11:21:36 PDT -07:00,
>       :secondary_name => nil,
>       :icon_file_name => nil,
>    :icon_content_type => nil,
>       :icon_file_size => nil,
>      :icon_updated_at => nil,
>     :descriptive_text => nil,
>                :ident => "juris-a88e89de29712642eaef324fd9bc03ed"
> }
> => nil
> ## in other words, j is assigned a DistrictSet object, that has j.id = 3
>
> [Development]>> j.save!
>  DistrictSet Load (0.3ms)   SELECT "district_sets".id FROM
> "district_sets" WHERE ("district_sets"."ident" =
> 'juris-a88e89de29712642eaef324fd9bc03ed' AND "district_sets".id <> 3)
> LIMIT 1
> [paperclip] Saving attachments.
> => true
> ## And when I ask activerecord to save it, I see the very odd <> 3.
>
> Do you understand what it means?

I may be wrong but have you got a validates_uniqueness_of on ident?
That query could be checking to see if there is already a matching
ident. The id<>3 could be so that it does not find the one you are
updating or creating.

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.

No comments:

Post a Comment