instance method
concerns
Ruby on Rails 8.1.4
Since v4.0.13Signature
concerns(*args, **options)
Use the named concerns
resources :posts do
concerns :commentable
end
Concerns also work in any routes helper that you want to use:
namespace :posts do
concerns :commentable
end
Parameters
-
argsrest -
optionskeyrest
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 2313
def concerns(*args, **options)
args.flatten.each do |name|
if concern = @concerns[name]
concern.call(self, options)
else
raise ArgumentError, "No concern named #{name} was found!"
end
end
end
Defined in actionpack/lib/action_dispatch/routing/mapper.rb line 2313
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::Mapper::Concerns