You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
I needed to apply the following patch in my project to see correct behavior with, e.g., optional belongs_to relationships, where the property should be allowed to be blank.
I didn't realize issues had been moved over here from Lighthouse, so here's an update I just posted over there:
I'm having this same problem, and it's really infuriating.
I have the following model:
class Product
include DataMapper::Resource
property :id, Serial
property :list_price, Decimal
# more properties, not relevant to problem
end
I want to update that model from a form and not set a list price, so I have params that look something like this:
{ 'product' => { 'list_price' => '' } }
The auto-validations generated for the list_price property have allow_nil: true but not allow_blank: true, meaning that when I update the product with the params above, it's invalid.
Unlike most of the other auto-validations, it seems there's no way to customize numericality, meaning I have to completely disable auto-validations and manually recreate them. I would expect to be able to do something like one of the following:
Ideally, though, I shouldn't even have to do that. I think that allow_blank should default to true under the same conditions as allow_nil since otherwise the property can't be updated from a form, which seems like a pretty prime use-case.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I needed to apply the following patch in my project to see correct behavior with, e.g., optional belongs_to relationships, where the property should be allowed to be blank.
https://gist.github.com/769298
Created by Bernerd Schaefer - 2011-01-07 09:56:10 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1469
The text was updated successfully, but these errors were encountered: