File tree 3 files changed +18
-3
lines changed
3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ matrix:
30
30
exclude :
31
31
- rvm : 2.4.2
32
32
gemfile : gemfiles/activerecord_6.0.0.gemfile
33
+ - rvm : 2.2.6
34
+ gemfile : gemfiles/activerecord_6.1.0.gemfile
35
+ - rvm : 2.3.5
36
+ gemfile : gemfiles/activerecord_6.1.0.gemfile
37
+ - rvm : 2.4.2
38
+ gemfile : gemfiles/activerecord_6.1.0.gemfile
33
39
- rvm : 2.2.6
34
40
gemfile : gemfiles/activerecord_master.gemfile
35
41
- rvm : 2.3.5
Original file line number Diff line number Diff line change
1
+ ## 3.2.1
2
+
3
+ * [ #674 ] ( https://github.com/CanCanCommunity/cancancan/pull/674 ) : Fix accidental dependency on ActiveRecord in 3.2.0. ([ @ghiculescu ] [ ] )
4
+
1
5
## 3.2.0
2
6
3
7
* [ #649 ] ( https://github.com/CanCanCommunity/cancancan/pull/649 ) : Add support for Single Table Inheritance. ([ @Liberatys ] [ ] )
Original file line number Diff line number Diff line change 3
3
module CanCan
4
4
def self . valid_accessible_by_strategies
5
5
strategies = [ :left_join ]
6
- strategies << :subquery unless CanCan :: ModelAdapters :: ActiveRecordAdapter . version_lower? ( '5.0.0' )
6
+ strategies << :subquery unless does_not_support_subquery_strategy?
7
7
strategies
8
8
end
9
9
@@ -25,7 +25,7 @@ def self.accessible_by_strategy
25
25
end
26
26
27
27
def self . default_accessible_by_strategy
28
- if CanCan :: ModelAdapters :: ActiveRecordAdapter . version_lower? ( '5.0.0' )
28
+ if does_not_support_subquery_strategy?
29
29
# see https://github.com/CanCanCommunity/cancancan/pull/655 for where this was added
30
30
# the `subquery` strategy (from https://github.com/CanCanCommunity/cancancan/pull/619
31
31
# only works in Rails 5 and higher
@@ -40,10 +40,15 @@ def self.accessible_by_strategy=(value)
40
40
raise ArgumentError , "accessible_by_strategy must be one of #{ valid_accessible_by_strategies . join ( ', ' ) } "
41
41
end
42
42
43
- if value == :subquery && CanCan :: ModelAdapters :: ActiveRecordAdapter . version_lower? ( '5.0.0' )
43
+ if value == :subquery && does_not_support_subquery_strategy?
44
44
raise ArgumentError , 'accessible_by_strategy = :subquery requires ActiveRecord 5 or newer'
45
45
end
46
46
47
47
@accessible_by_strategy = value
48
48
end
49
+
50
+ def self . does_not_support_subquery_strategy?
51
+ !defined? ( CanCan ::ModelAdapters ::ActiveRecordAdapter ) ||
52
+ CanCan ::ModelAdapters ::ActiveRecordAdapter . version_lower? ( '5.0.0' )
53
+ end
49
54
end
You can’t perform that action at this time.
0 commit comments