instance method
controller
Ruby on Rails 5.0.7.2
Since v3.0.20Signature
controller(controller, options = {})
Scopes routes to a specific controller
controller "food" do
match "bacon", action: :bacon, via: :get
end
Parameters
-
controllerreq -
optionsopt = {}
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 869
def controller(controller, options = {})
if options.empty?
begin
@scope = @scope.new(controller: controller)
yield
ensure
@scope = @scope.parent
end
else
ActiveSupport::Deprecation.warn "#controller with options is deprecated. If you need to pass more options than the controller name use #scope."
options[:controller] = controller
scope(options) { yield }
end
end
Defined in actionpack/lib/action_dispatch/routing/mapper.rb line 869
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::Mapper::Scoping