Sha256: 4bc761fa4f3d8250e0549f4dc1d3cde3a4f29eb5b5f5160f35aca252195906be

Contents?: true

Size: 967 Bytes

Versions: 24

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

# :markup: markdown

module AbstractController
  # # URL For
  #
  # Includes `url_for` into the host class (e.g. an abstract controller or
  # mailer). The class has to provide a `RouteSet` by implementing the `_routes`
  # methods. Otherwise, an exception will be raised.
  #
  # Note that this module is completely decoupled from HTTP - the only requirement
  # is a valid `_routes` 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

24 entries across 24 versions & 2 rubygems

Version Path
actionpack-8.0.2 lib/abstract_controller/url_for.rb
actionpack-8.0.1 lib/abstract_controller/url_for.rb
actionpack-8.0.0.1 lib/abstract_controller/url_for.rb
actionpack-7.2.2.1 lib/abstract_controller/url_for.rb
actionpack-8.0.0 lib/abstract_controller/url_for.rb
actionpack-7.2.2 lib/abstract_controller/url_for.rb
actionpack-8.0.0.rc2 lib/abstract_controller/url_for.rb
actionpack-7.2.1.2 lib/abstract_controller/url_for.rb
actionpack-8.0.0.rc1 lib/abstract_controller/url_for.rb
actionpack-7.2.1.1 lib/abstract_controller/url_for.rb
actionpack-8.0.0.beta1 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha9 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha8 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha7 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha4 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha3 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha2 lib/abstract_controller/url_for.rb
omg-actionpack-8.0.0.alpha1 lib/abstract_controller/url_for.rb
actionpack-7.2.1 lib/abstract_controller/url_for.rb
actionpack-7.2.0 lib/abstract_controller/url_for.rb