Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Date fields coerces invalid dates into valid dates which then passes validation #56

xargoon opened this Issue May 21, 2012 · 0 comments


None yet
1 participant

xargoon commented May 21, 2012

When using (for example) this property in the model:

 property :birthday, Date, required: true
 validates_primitive_type_of :birthday

and f.date_select :birthday, start_year: Time.now.year, end_year: 1900, prompt: true in the view, Rails/DM will change an invalid date like Year=nil, Day=nil, Month=11 to 0001-11-01, which then passes validation. It's not possible to do a manual validation, since you don't get the raw data in the model.
Only if all of the date parameters birthday(1i), birthday(2i), birthday(3i) is nil will validation fail.

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