Module: AdaptiveAlias::ActiveModelPatches::RemoveAliasAttribute
- Included in:
- ActiveModel::AttributeMethods::ClassMethods
- Defined in:
- lib/adaptive_alias/active_model_patches/remove_alias_attribute.rb
Instance Method Summary collapse
Instance Method Details
#remove_alias_attribute(new_name) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/adaptive_alias/active_model_patches/remove_alias_attribute.rb', line 10 def remove_alias_attribute(new_name) self.attribute_aliases = attribute_aliases.except(new_name.to_s) attribute_method_matchers.each do |matcher| matcher_new = matcher.method_name(new_name).to_s remove_proxy_call self, matcher_new end end |
#remove_proxy_call(mod, name) ⇒ Object
6 7 8 |
# File 'lib/adaptive_alias/active_model_patches/remove_alias_attribute.rb', line 6 def remove_proxy_call(mod, name) mod.module_eval "remove_method(:'#{name}')", __FILE__, __LINE__ + 1 end |