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.8.6 lib/abstract_controller/url_for.rb
actionpack-7.0.8.5 lib/abstract_controller/url_for.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.8.4/lib/abstract_controller/url_for.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/actionpack-7.0.5.1/lib/abstract_controller/url_for.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/actionpack-7.0.5.1/lib/abstract_controller/url_for.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/actionpack-7.0.5.1/lib/abstract_controller/url_for.rb
actionpack-7.0.8.4 lib/abstract_controller/url_for.rb
actionpack-7.0.8.1 lib/abstract_controller/url_for.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actionpack-7.0.3.1/lib/abstract_controller/url_for.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actionpack-7.0.2.3/lib/abstract_controller/url_for.rb
actionpack-7.0.8 lib/abstract_controller/url_for.rb
actionpack-7.0.7.2 lib/abstract_controller/url_for.rb
actionpack-7.0.7.1 lib/abstract_controller/url_for.rb
actionpack-7.0.7 lib/abstract_controller/url_for.rb
actionpack-7.0.6 lib/abstract_controller/url_for.rb
actionpack-7.0.5.1 lib/abstract_controller/url_for.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/actionpack-7.0.3.1/lib/abstract_controller/url_for.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/actionpack-7.0.2.3/lib/abstract_controller/url_for.rb
actionpack-7.0.5 lib/abstract_controller/url_for.rb
actionpack-7.0.4.3 lib/abstract_controller/url_for.rb