Sha256: 2996afbe5a9e408ed8af6ffefabb210a1d4a1508828df82a9b9200fe3bca35df

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

module EacRailsUtils
  module Patches
    module ActionControllerBasePatch
      def self.included(base)
        base.include InstanceMethods
      end

      module InstanceMethods
        def redirect_back(default_path, options = {})
          redirect_to :back, options
        rescue ActionController::RedirectBackError
          redirect_to default_path, options
        end
      end
    end
  end
end

patch = ::EacRailsUtils::Patches::ActionControllerBasePatch
target = ::ActionController::Base
target.send(:include, patch) unless target.included_modules.include?(patch)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eac_rails_utils-0.10.1 lib/eac_rails_utils/patches/action_controller_base.rb
eac_rails_utils-0.10.0 lib/eac_rails_utils/patches/action_controller_base.rb
eac_rails_utils-0.9.1 lib/eac_rails_utils/patches/action_controller_base.rb
eac_rails_utils-0.9.0 lib/eac_rails_utils/patches/action_controller_base.rb