module ActionDispatch::Routing::Mapper::Concerns
def concerns(*args)
concerns :commentable
namespace :posts do
Concerns also work in any routes helper that you want to use:
end
concerns :commentable
resources :posts do
Use the named concerns
def concerns(*args) options = args.extract_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