Skip to content

Commit

Permalink
Build/test against Ruby 3.0
Browse files Browse the repository at this point in the history
We've been passing translate options in a way which is not compatible
with Ruby 3. This led to the following error:

    ActionView::Template::Error: wrong number of arguments (given 2, expected 1)

Ruby 3 interprets keyword arguments vs. hashes differently. The I18n
source code has a comment which shows the correct expected usage:

  https://github.com/ruby-i18n/i18n/blob/v1.8.10/lib/i18n.rb#L181-L194

Removing the {} causes the arguments to be sent correctly.

Note that Ruby 3 is not expected to work with Rails 5.2:

  rails/rails#40938 (comment)
  • Loading branch information
dgmstuart committed May 20, 2021
1 parent 5ba5301 commit 5bf0153
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ script: bundle exec rake test
rvm:
- 2.6.7
- 2.7.3
- 3.0.1
gemfile:
- gemfiles/rails_5.gemfile
- gemfiles/rails_6.gemfile

matrix:
exclude:
- rvm: 3.0.1
gemfile: gemfiles/rails_5.gemfile

addons:
code_climate:
repo_token:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Next release

Other
- Build and test against Ruby 3.0

Bug fixes
- Regression: within an Engine, always look for Pundit policies in the engine (https://github.com/varvet/godmin/pull/259)

Expand Down
8 changes: 4 additions & 4 deletions app/views/godmin/resource/_pagination.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
</div>
<div class="pagination-entries pull-right hidden-xs">
<% if @resources.length == 0 %>
<%= translate_scoped("pagination.entries.zero", {
<%= translate_scoped("pagination.entries.zero",
resource: @resource_class.model_name.human(count: @resources.length).downcase
}) %>
) %>
<% else %>
<%= translate_scoped("pagination.entries.other", {
<%= translate_scoped("pagination.entries.other",
resource: @resource_class.model_name.human(count: @resources.length).downcase,
count: @resources.length,
total: @resource_service.paginator.total_resources
}) %>
) %>
<% end %>
</div>

0 comments on commit 5bf0153

Please sign in to comment.