Skip to content

Commit 37b56f4

Browse files
committed
Merge pull request activeadmin#3760 from rdlugosz/fix_ruby2_2_compatibility
Add parens to method calls used as arg defaults for Ruby 2.2, fix activeadmin#3733
2 parents 75df325 + fadbcb8 commit 37b56f4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ script: bundle exec rake test
22
rvm:
33
- 1.9.3
44
- 2.0.0
5+
- 2.2.0
56
before_install:
67
- gem update --system
78
- gem --version
@@ -11,5 +12,8 @@ env:
1112
- RAILS=3.1.12
1213
- RAILS=3.2.14
1314
matrix:
14-
allow_failures:
15+
exclude:
1516
- rvm: 2.0.0
17+
env: RAILS=3.0.20
18+
- rvm: 2.2.0
19+
env: RAILS=3.0.20

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ when /^3\.(1|2)/
1717
# These are the gems you have to have for Rails 3.1 to be happy
1818
gem 'sass-rails'
1919
gem 'uglifier'
20+
gem "test-unit", "~>3.0" # a rails 3.2 on ruby 2.2 requirement
2021
else
2122
raise "Rails #{rails_version} is not supported yet"
2223
end

lib/active_admin/helpers/collection.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ module Collection
77
# the ORDER statement mentions a column defined in the SELECT statement.
88
#
99
# We remove the ORDER statement to work around this issue.
10-
def collection_size(collection=collection)
10+
def collection_size(collection=collection())
1111
size = collection.reorder("").count
1212
# when GROUP BY is used, AR returns Hash instead of Fixnum for .size
1313
size = size.size if size.kind_of?(Hash)
1414

1515
size
1616
end
1717

18-
def collection_is_empty?(collection=collection)
18+
def collection_is_empty?(collection=collection())
1919
collection_size(collection) == 0
2020
end
2121
end

0 commit comments

Comments
 (0)