Skip to content

Commit 33ebf9b

Browse files
committed
String#insert() mutates the string, so no need for lasgn
1 parent 1e2ab56 commit 33ebf9b

File tree

1 file changed

+1
-1
lines changed
  • activerecord/lib/active_record/attribute_methods

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/attribute_methods/read.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def define_read_method(symbol, attr_name, column)
6464
access_code = cast_code ? "(v=@attributes['#{attr_name}']) && #{cast_code}" : "@attributes['#{attr_name}']"
6565

6666
unless attr_name.to_s == self.primary_key.to_s
67-
access_code = access_code.insert(0, "missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); ")
67+
access_code.insert(0, "missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); ")
6868
end
6969

7070
if cache_attribute?(attr_name)

0 commit comments

Comments
 (0)