Sha256: 5b8bf39f08a82a4a91fb46b1eb94ec6859a8070cf938b338d36b9fd6411f8d16

Contents?: true

Size: 942 Bytes

Versions: 37

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true

module AbstractController
  # Includes +url_for+ into the host class (e.g. an abstract controller or mailer). The class
  # has to provide a +RouteSet+ by implementing the <tt>_routes</tt> methods. Otherwise, an
  # exception will be raised.
  #
  # Note that this module is completely decoupled from HTTP - the only requirement is a valid
  # <tt>_routes</tt> implementation.
  module UrlFor
    extend ActiveSupport::Concern
    include ActionDispatch::Routing::UrlFor

    def _routes
      raise "In order to use #url_for, you must include routing helpers explicitly. " \
            "For instance, `include Rails.application.routes.url_helpers`."
    end

    module ClassMethods
      def _routes
        nil
      end

      def action_methods
        @action_methods ||= if _routes
          super - _routes.named_routes.helper_names
        else
          super
        end
      end
    end
  end
end

Version data entries

37 entries across 35 versions & 4 rubygems

Version Path
actionpack-7.0.4.2 lib/abstract_controller/url_for.rb
actionpack-7.0.4.1 lib/abstract_controller/url_for.rb
actionpack-7.0.4 lib/abstract_controller/url_for.rb
actionpack-7.0.3.1 lib/abstract_controller/url_for.rb
actionpack-7.0.3 lib/abstract_controller/url_for.rb
actionpack-7.0.2.4 lib/abstract_controller/url_for.rb
actionpack-7.0.2.3 lib/abstract_controller/url_for.rb
actionpack-7.0.2.2 lib/abstract_controller/url_for.rb
actionpack-7.0.2.1 lib/abstract_controller/url_for.rb
actionpack-7.0.2 lib/abstract_controller/url_for.rb
actionpack-7.0.1 lib/abstract_controller/url_for.rb
actionpack-7.0.0 lib/abstract_controller/url_for.rb
actionpack-7.0.0.rc3 lib/abstract_controller/url_for.rb
actionpack-7.0.0.rc2 lib/abstract_controller/url_for.rb
actionpack-7.0.0.rc1 lib/abstract_controller/url_for.rb
actionpack-7.0.0.alpha2 lib/abstract_controller/url_for.rb
actionpack-7.0.0.alpha1 lib/abstract_controller/url_for.rb