instance method
get
Ruby on Rails 8.1.2
Since v3.0.20Signature
get(*path_or_actions, as: DEFAULT, to: nil, controller: nil, action: nil, on: nil, defaults: nil, constraints: nil, anchor: nil, format: nil, path: nil, internal: nil, **mapping, &block)
Define a route that only recognizes HTTP GET. For supported arguments, see match
get 'bacon', to: 'food#bacon'
Parameters
-
path_or_actionsrest -
askey = DEFAULT -
tokey = nil -
controllerkey = nil -
actionkey = nil -
onkey = nil -
defaultskey = nil -
constraintskey = nil -
anchorkey = nil -
formatkey = nil -
pathkey = nil -
internalkey = nil -
mappingkeyrest -
blockblock
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 738
def get(*path_or_actions, as: DEFAULT, to: nil, controller: nil, action: nil, on: nil, defaults: nil, constraints: nil, anchor: nil, format: nil, path: nil, internal: nil, **mapping, &block)
if path_or_actions.grep(Hash).any? && (deprecated_options = path_or_actions.extract_options!)
as = assign_deprecated_option(deprecated_options, :as, :get) if deprecated_options.key?(:as)
to ||= assign_deprecated_option(deprecated_options, :to, :get)
controller ||= assign_deprecated_option(deprecated_options, :controller, :get)
action ||= assign_deprecated_option(deprecated_options, :action, :get)
on ||= assign_deprecated_option(deprecated_options, :on, :get)
defaults ||= assign_deprecated_option(deprecated_options, :defaults, :get)
constraints ||= assign_deprecated_option(deprecated_options, :constraints, :get)
anchor = assign_deprecated_option(deprecated_options, :anchor, :get) if deprecated_options.key?(:anchor)
format = assign_deprecated_option(deprecated_options, :format, :get) if deprecated_options.key?(:format)
path ||= assign_deprecated_option(deprecated_options, :path, :get)
internal ||= assign_deprecated_option(deprecated_options, :internal, :get)
assign_deprecated_options(deprecated_options, mapping, :get)
end
match(*path_or_actions, as:, to:, controller:, action:, on:, defaults:, constraints:, anchor:, format:, path:, internal:, **mapping, via: :get, &block)
self
end
Defined in actionpack/lib/action_dispatch/routing/mapper.rb line 738
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::Mapper::HttpHelpers