interference with dm-timestamps and dm-validations
Reported by mark | June 11th, 2008 @ 03:44 AM | in 0.9.2
It seems that when I include both dm-timestamps and dm-validations, my DataMapper models continue to save even when they are invalid.
I have confirmed this by disabling dm-timestamps (and disabled my tests that rely on dm-timestamps), then all tests work as expected.
The following test was used to narrow down this problem:
it "should require a name" do
@person = Person.new
@person.should_not be_valid
@person.errors.on(:name).size.should == 1
@person.errors.on(:name).should include("Name must not be blank")
Person.all.size.should == 0
@person.save
Person.all.size.should == 0
end
When dm-timestamps is disabled, the test passes. When dm-timestamps is included, the test fails on the last assertion (Person.all.size.should == 0) as the model saves, ignoring the validations.
My setup:
merb* 0.9.3
addressable 1.0.4
rspec 1.1.4
data_objects 0.9.1
do_mysql 0.9.1
dm-core 0.9.1
dm-more 0.9.1
Side Note:
It seems the order I include the dependencies is important. In my config/init.rb (merb config file), I have the following:
dependency 'dm-timestamps'
dependency 'dm-validations'
If I reverse the order of the dependencies, I generate numerous errors in my tests, eg:
"super: no superclass method `save'"
Comments and changes to this ticket
-
Adam French June 12th, 2008 @ 01:03 PM
- → Milestone changed from to 0.9.2
-
Adam French June 12th, 2008 @ 01:09 PM
Mark, could you pastie the beginning part of your Person class? specifically the `include` parts?
-
mark June 12th, 2008 @ 05:22 PM
http://pastie.textmate.org/214069
BTW, if you want I can create a minimal merb app that generates the error and send it to you somehow.
-
Carl Lerche June 12th, 2008 @ 05:46 PM
I'm pretty sure that this is a duplicate of #371 (well, probably the other way around, mine was a duplicate).
I already patched this in master. So, it should be good to go.
-
Carl Lerche July 6th, 2008 @ 12:19 PM
- → State changed from new to invalid
- → Tag changed from to dm-more merb_datamapper validations
- → Assigned user changed from Sam Smoot to Carl Lerche
This is a duplicate of #371 and has been resolved.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
