Saving left 0 padded strings (e.g. "030") as integers cause saving to fail silently #228

Closed
endoscient opened this Issue Oct 1, 2012 · 4 comments

3 participants

@endoscient
class Foo
  include DataMapper::Resource  
  property :id, Serial
  property :number, Integer
end

f = Foo.new({ :number => "030" })
f.valid? # true
f.save # false
f.errors # {}

Using latest released version of everything, with sqlite adpator.

Solution. Either have it return a validation error, or parse the string to an integer.

@FeeJai

I am still having this error. is there a solution?

@tpitale
DataMapper member

The pull request was closed. I assume it was merged into release-1.2, but it does not appear in master. I'm not sure what happened to the release-1.2 branch, it's also not in the v1.2.0 tag.

If this is something you'd still like, I'll accept a PR against master. Thanks!

@tpitale tpitale closed this Feb 14, 2016
@FeeJai

Hey. It wasn't merged because I did not provide any specs. I do not work with data mapper anymore. The bug still exists though and is severe. Not saving but returning success is dangerous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment