Skip to content

Commit 143d51a

Browse files
authored
Merge pull request rails#52841 from rails/revert-52822-active-model-alias
Revert "alias_attribute: handle user defined source methods"
2 parents b2567ea + 55be708 commit 143d51a

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

activemodel/lib/active_model/attribute_methods.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,7 @@ def eagerly_generate_alias_attribute_methods(new_name, old_name) # :nodoc:
215215
end
216216

217217
def generate_alias_attribute_methods(code_generator, new_name, old_name)
218-
ActiveSupport::CodeGenerator.batch(code_generator, __FILE__, __LINE__) do |owner|
219-
attribute_method_patterns.each do |pattern|
220-
old_attribute_method = pattern.method_name(old_name)
221-
if method_defined?(old_attribute_method, false)
222-
alias_method(pattern.method_name(new_name), old_attribute_method)
223-
else
224-
define_attribute_method_pattern(pattern, old_name, owner: owner, as: new_name)
225-
end
226-
end
227-
attribute_method_patterns_cache.clear
228-
end
218+
define_attribute_method(old_name, _owner: code_generator, as: new_name)
229219
end
230220

231221
def alias_attribute_method_definition(code_generator, pattern, new_name, old_name) # :nodoc:

0 commit comments

Comments
 (0)