Skip to content

Commit

Permalink
Merge pull request rails#52841 from rails/revert-52822-active-model-a…
Browse files Browse the repository at this point in the history
…lias

Revert "alias_attribute: handle user defined source methods"
  • Loading branch information
byroot authored Sep 9, 2024
2 parents b2567ea + 55be708 commit 143d51a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions activemodel/lib/active_model/attribute_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,7 @@ def eagerly_generate_alias_attribute_methods(new_name, old_name) # :nodoc:
end

def generate_alias_attribute_methods(code_generator, new_name, old_name)
ActiveSupport::CodeGenerator.batch(code_generator, __FILE__, __LINE__) do |owner|
attribute_method_patterns.each do |pattern|
old_attribute_method = pattern.method_name(old_name)
if method_defined?(old_attribute_method, false)
alias_method(pattern.method_name(new_name), old_attribute_method)
else
define_attribute_method_pattern(pattern, old_name, owner: owner, as: new_name)
end
end
attribute_method_patterns_cache.clear
end
define_attribute_method(old_name, _owner: code_generator, as: new_name)
end

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

0 comments on commit 143d51a

Please sign in to comment.