Skip to content

Commit 730c315

Browse files
author
Jesús Burgos
committed
fix?
1 parent 597e5d8 commit 730c315

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lib/rails-settings.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ def self.can_protect_attributes?
77
end
88

99
def self.can_use_becomes?
10-
version = ActiveRecord::VERSION
11-
return false if version::MAJOR == 3
12-
return false if version::MAJOR == 4 && version::MINOR == 1
13-
14-
true
10+
![
11+
[3, 0],
12+
[3, 1],
13+
[3, 2],
14+
[4, 0]
15+
].include?([ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR])
1516
end
1617
end
1718

@@ -28,4 +29,3 @@ def self.has_settings(*args, &block)
2829
extend RailsSettings::Scopes
2930
end
3031
end
31-

lib/rails-settings/setting_object.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def respond_to?(method_name, include_priv=false)
3232
unless RailsSettings.can_use_becomes?
3333
def becomes(klass)
3434
became = super(klass)
35-
changed_attributes = @changed_attributes if defined?(@changed_attributes)
36-
became.instance_variable_set("@changed_attributes", changed_attributes || {})
35+
became.instance_variable_set("@changed_attributes", @changed_attributes)
3736
became
3837
end
3938
end

0 commit comments

Comments
 (0)