Sha256: dc20b5dc36fb615265a7cf91d450f1c2b59ff42247616c3fe6f1adbd652d7588

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

require 'active_model'

module ActiveModel::AttributeMethods
  module ClassMethods
    def remove_proxy_call(mod, name)
      mod.module_eval "remove_method(:'#{name}')", __FILE__, __LINE__ + 1
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adaptive_alias-0.1.0 lib/adaptive_alias/active_model_patches/remove_alias_attribute.rb