Thanks Ted I've been spending all day debugging this, and I can confirm that my relationships are all over the place + I had some legacy columns in my table that should not have been there anymore. Basically it would refuse to save my record because it expected more fields.
It's tough developing a db driven app with only the most basic knowledge of dbs :/ But well I'm learning and making progress, so there's that. And I've managed to save a record at last, although I'm far from out of the woods. Cheerio, and thanks for all the help. On Friday, August 17, 2012 2:54:37 PM UTC+2, Ted Han wrote: > > So if you have multiple unsaved objects that you are instructing > DataMapper to save at once (say an object, plus some child objects that are > attached through a relationship) and the child objects validations fail, > and will not save, the whole save will fail, even if the object you're > calling save on is valid. So i'd double check that your relationships are > valid as well. > > The other possibility is that there are constraints that are setup on the > DB that are blocking the save from going through, even though datamapper > thinks things are valid. One thing you could do is check out what sql is > generated, or see if there's an error being thrown back. Using a logger to > inspect all of this can be pretty helpful. > > On Fri, Aug 17, 2012 at 3:23 AM, manu <etab...@gmail.com <javascript:>>wrote: > >> Mmm, I removed date_hist altogether to test, and it hasn't fixed the >> issue :/ >> >> >> On Friday, August 17, 2012 9:20:31 AM UTC+2, mbj wrote: >> >>> Hi, >>> >>> There is a bug that can cause silent safe failures. >>> >>> The bug is triggered when trying to save a value where >>> Property#valid?(value) is false. In the current releases >>> it fails silently. >>> >>> Must likely the date_hist property with the value 1955 is >>> triggering this behavior. You can verify it with using dm-core >>> from current master branch (it should raise an exception). >>> >>> Regards, >>> >>> Markus >>> >>> On Thu, Aug 16, 2012 at 03:10:33PM -0700, manu wrote: >>> > Hi folks >>> > >>> > I'm building a sinatra app with DataMapper. >>> > >>> > One of my models is misbehaving, but I can't figure out what is wrong. >>> > >>> > Basically when I try to create a new Mission record, it refuses to >>> save it, >>> > but does not give me any kind of error message to help me figure out >>> why. >>> > >>> > When I inspect the record/object, all the data I passed to the >>> properties >>> > are there, but it doesn't create an @id(=nil) or @created_at(=nil), >>> > presumably because it will not create it :/ >>> > >>> > Any idea how I can draw out some more information? >>> > >>> > Here's some info on the model: >>> > >>> > class Mission >>> > include DataMapper::Resource >>> > >>> > property :id, Serial #auto-increment integer key >>> > property :numero, Integer, :required => true >>> > property :nom, String, :required => true >>> > property :briefing, Text, :required => false, :default => "Pas >>> de >>> > briefing" >>> > property :debriefing, Text, :required => false, :default => "Pas >>> de >>> > debriefing" >>> > property :date_hist, DateTime,:required => false >>> > property :created_at, DateTime >>> > >>> > belongs_to :campagne >>> > >>> > has n, :flights >>> > has n, :avatars, :through => :flights >>> > >>> > end >>> > >>> > I use a seed script to create the record: >>> > >>> > m1=Mission.first_or_create(:**numero => 5, >>> > :nom => 'La Belle Rouge', >>> > :briefing => 'test', >>> > :debriefing => 'test', >>> > :date_hist => 1955) >>> > >>> > here's what I get in the console when I run the seed script: >>> > >>> > => [#<Mission @id=nil @numero=5 @nom="La Belle Rouge" @briefing="test" >>> > @debriefing="test" @date_hist=1942 @created_at=nil @campagne_id=3 >>> > @promotion_avatar_id=nil @promotion_grade_id=nil @reward_avatar_id=nil >>> > @reward_decoration_id=nil>] >>> > >>> > >>> > Is it something about the relationships that HAVE to be created first >>> > before I can create a Mission record? >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> Groups "DataMapper" group. >>> > To view this discussion on the web visit https://groups.google.com/d/* >>> *msg/datamapper/-/YqFKy6fe8lEJ<https://groups.google.com/d/msg/datamapper/-/YqFKy6fe8lEJ>. >>> >>> >>> > To post to this group, send email to datam...@googlegroups.com. >>> > To unsubscribe from this group, send email to datamapper+...@** >>> googlegroups.com. >>> > For more options, visit this group at http://groups.google.com/** >>> group/datamapper?hl=en <http://groups.google.com/group/datamapper?hl=en>. >>> >>> > >>> >>> -- >>> Markus Schirp >>> >>> Phone: +49 201 / 360 379 14 >>> Fax: +49 201 / 360 379 16 >>> Web: www.seonic.net >>> Email: m...@seonic.net >>> Twitter: twitter.com/_m_b_j_ >>> OS-Code <http://twitter.com/_m_b_j_OS-Code>: github.com/mbj >>> >>> Seonic IT-Systems GbR >>> Anton Shatalov & Markus Schirp >>> Altendorferstrasse 44 >>> D-45127 Essen >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "DataMapper" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/datamapper/-/nluT7YIURm8J. >> >> To post to this group, send email to datam...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> datamapper+...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/datamapper?hl=en. >> > > > > -- > Ted Han > @knowtheory <http://twitter.com/knowtheory> > DocumentCloud > Investigative Reporters & Editors > > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To view this discussion on the web visit https://groups.google.com/d/msg/datamapper/-/jmZyvAbcys0J. To post to this group, send email to datamapper@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.