Sha256: 1cfc13d431f595f317aa322f916f763d9b303886ce30205174247a858f57f0fd

Contents?: true

Size: 945 Bytes

Versions: 74

Compression:

Stored size: 945 Bytes

Contents

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 ||= begin
          if _routes
            super - _routes.named_routes.helper_names
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 4 rubygems

Version Path
actionpack-4.1.16 lib/abstract_controller/url_for.rb
actionpack-4.1.16.rc1 lib/abstract_controller/url_for.rb
actionpack-4.1.15 lib/abstract_controller/url_for.rb
actionpack-4.1.15.rc1 lib/abstract_controller/url_for.rb
actionpack-4.1.14.2 lib/abstract_controller/url_for.rb
actionpack-4.1.14.1 lib/abstract_controller/url_for.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/actionpack-4.1.13/lib/abstract_controller/url_for.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/actionpack-4.1.13/lib/abstract_controller/url_for.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/actionpack-4.1.13/lib/abstract_controller/url_for.rb
actionpack-4.1.14 lib/abstract_controller/url_for.rb
actionpack-4.1.14.rc2 lib/abstract_controller/url_for.rb
actionpack-4.1.14.rc1 lib/abstract_controller/url_for.rb
actionpack-4.1.13 lib/abstract_controller/url_for.rb
actionpack-4.1.13.rc1 lib/abstract_controller/url_for.rb
actionpack-4.1.12 lib/abstract_controller/url_for.rb
actionpack-4.1.12.rc1 lib/abstract_controller/url_for.rb
actionpack-4.1.11 lib/abstract_controller/url_for.rb
actionpack-4.1.10 lib/abstract_controller/url_for.rb
actionpack-4.1.10.rc4 lib/abstract_controller/url_for.rb
actionpack-4.1.10.rc3 lib/abstract_controller/url_for.rb