123456789_123456789_123456789_123456789_123456789_

Module: AbstractController::UrlFor

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
::ActionController::API, ::ActionController::Base, ::ActionController::Redirecting, ::ActionController::UrlFor, ::ActionView::TestCase::TestController, Rails::ApplicationController, Rails::InfoController, Rails::MailersController, Rails::WelcomeController
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: actionpack/lib/abstract_controller/url_for.rb

Overview

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.

::ActionDispatch::Routing::UrlFor - Attributes & Methods

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

Instance Method Summary

::ActionDispatch::Routing::UrlFor - Included

#initialize,
#route_for

Allows calling direct or regular named route.

#url_for

Generate a URL based on the options provided, default_url_options and the routes defined in routes.rb.

#url_options

Hook overridden in controller to add request information with .default_url_options.

#_routes_context, #_with_routes

::ActionDispatch::Routing::PolymorphicRoutes - Included

#polymorphic_path

Returns the path component of a URL for the given record.

#polymorphic_url

Constructs a call to a named RESTful route for the given record and returns the resulting URL string.

Class Attribute Details

.default_url_options (rw)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/url_for.rb', line 95

class_attribute :default_url_options

.default_url_options?Boolean (rw)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/url_for.rb', line 95

class_attribute :default_url_options

Instance Attribute Details

#default_url_options (rw)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/url_for.rb', line 95

class_attribute :default_url_options

#default_url_options?Boolean (rw)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/url_for.rb', line 95

class_attribute :default_url_options

Instance Method Details

#_routes

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/url_for.rb', line 14

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