Skip to content

Commit 41f9afb

Browse files
authored
fix: use update instead of update_attribute to ensure rails 6.1 compatibility (#417)
1 parent ce5e2f8 commit 41f9afb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/services/forest_liana/resource_creator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def set_has_many_relationships
5353
end
5454

5555
def has_strong_parameter
56-
Rails::VERSION::MAJOR > 5 || @resource.instance_method(:update_attributes!).arity == 1
56+
Rails::VERSION::MAJOR > 5 || @resource.instance_method(:update!).arity == 1
5757
end
5858
end
5959
end

app/services/forest_liana/resource_updater.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ def perform
1414
@record = @resource.find(@params[:id])
1515

1616
if has_strong_parameter
17-
@record.update_attributes(resource_params)
17+
@record.update(resource_params)
1818
else
19-
@record.update_attributes(resource_params, without_protection: true)
19+
@record.update(resource_params, without_protection: true)
2020
end
2121
rescue ActiveRecord::StatementInvalid => exception
2222
# NOTICE: SQL request cannot be executed properly
@@ -33,7 +33,7 @@ def resource_params
3333
end
3434

3535
def has_strong_parameter
36-
Rails::VERSION::MAJOR > 5 || @resource.instance_method(:update_attributes!).arity == 1
36+
Rails::VERSION::MAJOR > 5 || @resource.instance_method(:update!).arity == 1
3737
end
3838
end
3939
end

0 commit comments

Comments
 (0)