Just a stab in the dark, but I haven't seen any mention of calling
save vs. save!. save just puts any errors in the model, save! will
raise the exception if there are any errors. That may not be the case
for ActiveRecord:StatementInvalid exception, but I thought i'd mention
it anyway.

I wondered about this but I think that since the DBMS exception is not
being trapped at all that it makes no difference. However, I will check
if if it does or not anyway.

Right - this is from the validates_uniqueness_of documentation:
#   When the database catches such a duplicate insertion,
#   ActiveRecord::Base#save will raise an ActiveRecord::StatementInvalid
#   exception. You can either choose to let this error propagate (which
#   will result in the default Rails exception page being shown), or you
#   can catch it and restart the transaction (e.g. by telling the user
# that the title already exists, and asking him to re-enter the title).
#   This technique is also known as optimistic concurrency control:
#   http://en.wikipedia.org/wiki/Optimistic_concurrency_control

so it _should_ be bubbling through. Odd that it would change in Ruby 1.8.6, but it's worth a try.

timg
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to