Newbie: datamapper doesn't tell me why I fail to save

600 views
Skip to first unread message

Charles Monteiro

unread,
Jun 14, 2013, 11:31:21 AM6/14/13
to datam...@googlegroups.com
its odd, I have turned on errors and I get the following:

DataMapper::SaveFailureError: Project#save returned false, Project was not saved

not telling me much.

I check the error hash and that's empty. 

How does a newbie understand what dependencies etc I'm not fulfilling in the creation of an object.

BTW, in case it matters I'm creating an object just by new and then sending save. This object does have associations so I'm assuming that's where the issue but I really would like to know what Datamapper thinks is the problem. Currently, I'm confused as to why its not saving.

Any feedback is appreciated.

thanks

-Charles

Antonio Antillon

unread,
Jun 14, 2013, 11:34:46 AM6/14/13
to datam...@googlegroups.com

Could you show some code? How's your model declared and how are you instantiating a new object and then saving it?

--
You received this message because you are subscribed to the Google Groups "DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datamapper+...@googlegroups.com.
To post to this group, send email to datam...@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

kristian

unread,
Jun 14, 2013, 11:48:06 AM6/14/13
to datam...@googlegroups.com
since I added the following extension https://github.com/solnic/dm-validations-ext/tree/master/lib to my code, all those errors from associations show up as well, which are otherwise totally as in your case. maybe that helps you as well.

- christian

Charles Monteiro

unread,
Jun 14, 2013, 12:08:04 PM6/14/13
to datam...@googlegroups.com, m.kri...@web.de
thank you , I"ll check it out, yes that would be useful. another user informed of "full_messages" the problem though was that the error was in one of the associated objects and not in the root object. So this ext would indeed be quite useful. 

Unfortunately it does not seem to be updated to work with the latest datamapper, perhaps its just a gemspec thing, here's the bundler output;

Bundler could not find compatible versions for gem "dm-core":
  In Gemfile:
    dm-validations-ext (>= 0) java depends on
      dm-core (~> 1.1.0) java

    data_mapper (>= 0) java depends on
      dm-core (1.2.1)

Bundler could not find compatible versions for gem "dm-validations":
  In Gemfile:
    dm-validations-ext (>= 0) java depends on
      dm-validations (~> 1.0.2) java

    data_mapper (>= 0) java depends on
      dm-validations (1.2.0)

Process finished with exit code 6

Charles Monteiro

unread,
Jun 14, 2013, 12:19:49 PM6/14/13
to datam...@googlegroups.com
oh, yes the problem turns out that I was mistakenly using a "Decimal" and then trying to set the object with a float e.g. project.weight = 0.20 , the spec requires one to use "Float"

tangent:  is there a nicer way of describing a percentage ? I suppose this works fine 

kristian

unread,
Jun 15, 2013, 4:33:36 AM6/15/13
to datam...@googlegroups.com
yes, the gem does not install because of the gemspec that is why I copied and pasted that file into my project.

-christian
Reply all
Reply to author
Forward
0 new messages