123456789_123456789_123456789_123456789_123456789_

Module: AbstractController::UrlFor

Overview

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.

::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.

append_features, prepend_features

Instance Attribute Summary

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 config/routes.rb.

#url_options

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

#_routes_context, #_with_routes, #full_url_for

::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.

#polymorphic_mapping, #polymorphic_path_for_action, #polymorphic_url_for_action

Class Attribute Details

.default_url_options (rw)

[ GitHub ]

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

class_attribute :default_url_options

.default_url_options?Boolean (rw)

[ GitHub ]

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

class_attribute :default_url_options

Instance Attribute Details

#default_url_options (rw)

[ GitHub ]

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

class_attribute :default_url_options

#default_url_options?Boolean (rw)

[ GitHub ]

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

class_attribute :default_url_options

Instance Method Details

#_routes

[ GitHub ]

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

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