2009/7/4 Learn by Doing <[email protected]>: > > Hi Conrad, > > I am using Rails 2.3.2 and Ruby 1.8.7, the latest stable combination > recommended by rubyonrails.org. > > I am continuing to troubleshoot this. I have deleted all the sample > data that I preloaded so that my database is empty. Now, the opposite > is happening, it is letting me create records in violation of the > uniqueness validation: > >>> stat0 = Stat.new(:user_id => 1000, :aspect => "aspect0") > => #<Stat id: nil, user_id: 1000, aspect: "aspect0"> >>> stat0.save! > => true >>> stat0 = Stat.new(:user_id => 1000, :aspect => "aspect0") > => #<Stat id: nil, user_id: 1000, aspect: "aspect0"> >>> stat0.save! > => true > > I check the database and yes it contains both of the above identical > records. Only their :Stat_ids are different. Something wrong with my > uniqueness validation? > > validates_uniqueness_of :aspect, :scope => :user_id >
Can you post the model code and the db structure for this table please? 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

