-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider including DataMapper hack to coerce empty Strings to nil, for Integer properties #916
Comments
Agreed, this really caused me a headache when trying to implement optional associations. |
|
Are we protected from mass assignment in any way? These issues should be resolved together. |
Should we plan this for 1.0 or close as #905 is there to protect from mass assignment. I think disallowed params should be deleted and good ones cast to integers or nils. |
Good call @ujifgc. Rescheduled it for 1.0. |
Closing in favor of #1524. Also you can use params protection to typecast foreign keys:
|
@ujifgc too cool! |
When submitting forms that include foreign-key values (
foo_id=1
), DataMapper is unable to coerce an empty String (the default value of a form field) tonil
. Instead, DataMapper complains that the foreign-key must benil
or an Integer. As a work-around, I use this monkey-patch toDataMapper::Property::Integer
:See also: datamapper/dm-rails#27
The text was updated successfully, but these errors were encountered: