Skip to content

Commit

Permalink
Fix bug: scoped attributes of data type time
Browse files Browse the repository at this point in the history
See issue #1114: validate_uniqueness_of with scoped_to fails when the scope is of data type time
  • Loading branch information
mikeduynguyen committed Mar 19, 2019
1 parent dc34d34 commit 4b7b15b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -830,7 +830,7 @@ def next_scalar_value_for(scope, previous_value)
elsif previous_value.respond_to?(:next)
previous_value.next
elsif previous_value.respond_to?(:to_datetime)
previous_value.to_datetime.next
previous_value.to_datetime.in(60).next
elsif boolean_value?(previous_value)
!previous_value
else
Expand Down
Expand Up @@ -830,6 +830,11 @@
include_context 'it supports scoped attributes of a certain type',
column_type: :datetime
end

context 'when one of the scoped attributes is a time column (using Time)' do
include_context 'it supports scoped attributes of a certain type',
column_type: :time
end

context 'when one of the scoped attributes is a datetime column (using Time)' do
include_context 'it supports scoped attributes of a certain type',
Expand Down

0 comments on commit 4b7b15b

Please sign in to comment.