Sha256: db1a6a0616b9b34733e72d83582e035284d499f7a9cc4ec03aeb8effae61d024
Contents?: true
Size: 917 Bytes
Versions: 14
Compression:
Stored size: 917 Bytes
Contents
# frozen_string_literal: true require 'activemodel/associations' require 'eac_ruby_utils/core_ext' module EacRailsUtils module Patches module Rails52 class ActiveModelAssociationMethodFix common_constructor :method_name do perform end def original_method_new_name "original_#{method_name}".to_sym end private def the_module ::ActiveModel::Associations::ClassMethods end def perform patch = self the_module.class_eval do alias_method patch.original_method_new_name, patch.method_name remove_method patch.method_name define_method patch.method_name do |name, scope = nil, **options, &extension| send(patch.original_method_new_name, name, scope, options, &extension) end end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems