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
I noticed this issue when I was getting inconsistent behaviour from passing find_or_create a Time object as the value for a query against a date field. create type-casts this value before saving, but it seems find and where do not.
The problem can obviously be fixed by calling #to_date on the Time object beforehand, or using a Date object in the first place, but I believe the type-casting behaviour should be consistent to avoid confusion.
Currently `Type::Date#serialize` does not cast a value to a date object.
It should be cast to a date object for finding by date column correctly
working.
Fixesrails#25354.
Currently `Type::Date#serialize` does not cast a value to a date object.
It should be cast to a date object for finding by date column correctly
working.
Fixesrails#25354.
MichaelSp
pushed a commit
to MichaelSp/rails
that referenced
this issue
Nov 2, 2016
Currently `Type::Date#serialize` does not cast a value to a date object.
It should be cast to a date object for finding by date column correctly
working.
Fixesrails#25354.
I noticed this issue when I was getting inconsistent behaviour from passing
find_or_create
a Time object as the value for a query against a date field.create
type-casts this value before saving, but it seemsfind
andwhere
do not.The problem can obviously be fixed by calling
#to_date
on the Time object beforehand, or using a Date object in the first place, but I believe the type-casting behaviour should be consistent to avoid confusion.Steps to reproduce
View Test Case
Expected behavior
Actual behavior
System configuration
Rails version: 5.0.0.rc1
Ruby version: 2.3.0p0
The text was updated successfully, but these errors were encountered: