Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,7 +437,7 @@ def attributes_with_values(attribute_names) | |
def attributes_for_update(attribute_names) | ||
attribute_names &= self.class.column_names | ||
attribute_names.delete_if do |name| | ||
readonly_attribute?(name) | ||
self.class.readonly_attribute?(name) | ||
end | ||
end | ||
|
||
|
@@ -460,10 +460,6 @@ def format_for_inspect(value) | |
end | ||
end | ||
|
||
def readonly_attribute?(name) | ||
self.class.readonly_attributes.include?(name) | ||
end | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rafaelfranca
Member
|
||
|
||
def pk_attribute?(name) | ||
name == @primary_key | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Came across this change upgrading from Rails 6.0 to 6.1
I had relied on overriding this instance method in Rails <= 6.0 to, in super special circumstances, return 'false' and thereby skip this check.
May I may an issue or PR to restore an instance method
readonly_attribute?
(which calls the class method?)I think it's reasonable since the instance method
verify_readonly_attribute?
still exists and delegates to a class method