Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,25 @@ jobs:
strategy:
matrix:
ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7]
activemodel: [3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0]
activemodel: [3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0, 6.1]
include:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've chosen include here rather than explicitly excluding ActiveModel 3.2 - 5.2 for Ruby 3.0

- ruby: 3.0
activemodel: 6.0
- ruby: 3.0
activemodel: 6.1
exclude:
- ruby: 2.2
activemodel: 6.0
- ruby: 2.3
activemodel: 6.0
- ruby: 2.4
activemodel: 6.0
- ruby: 2.2
activemodel: 6.1
- ruby: 2.3
activemodel: 6.1
- ruby: 2.4
activemodel: 6.1
fail-fast: true
env:
ACTIVE_MODEL_VERSION: ${{ matrix.activemodel }}
Expand Down
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ active_model_opts =
end

gem 'activemodel', active_model_opts

platforms :rbx do
gem 'rubysl', '~> 2.0'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through history, it looks like this was added to test against Rubinius at some stage in the past?

end
8 changes: 4 additions & 4 deletions lib/active_model/validations/date_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ def validate_each(record, attr_name, value)
end

if value_before_type_cast.present? && value.nil?
record.errors.add(attr_name, :not_a_date, options)
record.errors.add(attr_name, :not_a_date, **options)
return
end

return if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])

unless value
record.errors.add(attr_name, :not_a_date, options)
record.errors.add(attr_name, :not_a_date, **options)
return
end

unless is_time?(value)
record.errors.add(attr_name, :not_a_date, options)
record.errors.add(attr_name, :not_a_date, **options)
return
end

Expand All @@ -94,7 +94,7 @@ def validate_each(record, attr_name, value)
end

unless is_time?(option_value) && value.to_i.send(CHECKS[option], option_value.to_i)
record.errors.add(attr_name, :"date_#{option}", options.merge(
record.errors.add(attr_name, :"date_#{option}", **options.merge(
value: original_value,
date: (I18n.localize(original_option_value) rescue original_option_value)
))
Expand Down