Ok, I've been trying to isolate the simplest example that causes
problems. Here's a model -

------
class Event
  include DataMapper::Resource

  property :id, Serial
  property :name, Text
end
------

And an irb session -

------
$bin/merb -i
irb(main):001:0>e = Event.new
=> #<Event @id=nil @name=nil>
irb(main):002:0> e.save
=> true
irb(main):003:0>e = Event.get(1)
=> #<Event @id=1 @name=<not loaded>>
irb(main):004:0> e.name = 'test'
=> "test"
irb(main):005:0> e.save
=> false
irb(main):006:0> e
=> #<Event @id=1 @name="test">
--------

So what seems to happen is that 'save' returns false, even though the
object is saved successfully. I've tried the same thing with the :name
attribute defined as a String and get the same result except that the
nil name gets loaded when Event.get(1) is executed.

I would be interested to know if someone can reproduce this or suggest
what is going wrong.

Mark.


Kai Chen wrote:
> I think giving a code snippet to reproduce the problem will be helpful.
>
> --
> Regards,
> Kai Chen
>
>
> On Tue, Oct 20, 2009 at 9:40 AM, MarkMT <mark.thom...@ieee.org> wrote:
> >
> > Hmm... not sure, but seems like that method is maybe defined by a call
> > to rb_define_method in do_mysql_ext.c, though I don't claim to really
> > understand what is going on there. So I'm left wondering how to figure
> > out why the resource's update method returns false.
> >
> > Clues appreciated. FWIW, I'm trying to debug something that works fine
> > in DM 0.9.11 with Merb 1.0.11.
> >
> > Mark.
> >
> >
> >
> > MarkMT wrote:
> >> I'm trying to track down a problem I have with a resource in 0.10.1
> >> that is failing to be saved despite passing its validations.
> >>
> >> Updating the resource leads to the invocation of
> >> DataMapper::Repository#update, which is defined in dm-core/
> >> repository.rb. This method calls 'update' on a
> >> DataMapper::Adapters::MysqlAdapter object, which is subclassed in dm-
> >> core/adapters/mysql_adapter.rb from
> >> DataMapper::Adapters::DataObjectsAdapter.
> >>
> >> That class is defined in dm-core/adapters/data_objects_adapter.rb and
> >> and its 'update' method calls 'execute' which creates a
> >> DataObjects::Mysql::Command object and calls 'execute_non_query' on
> >> it.
> >>
> >> However, I'm having difficulty figuring out where that class and its
> >> 'execute_non_query method' is defined. grep only turns up
> >> DataObjects::Command#execute_non_query, but that isn't what is being
> >> called.
> >>
> >> Can someone point me in the right direction?
> > >
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to