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 authored and mcmire committed Jul 11, 2020
1 parent 47ca467 commit 7f9fb4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -820,7 +820,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 @@ -829,6 +829,11 @@
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',
column_type: :datetime,
Expand Down

0 comments on commit 7f9fb4e

Please sign in to comment.