Extend concerns to scopes and namespaces. #7

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@pschambacher

As for now routing concerns were only available for resources.
Some people may need it for scopes or namespace to DRY their routes.

Fix #4
I'll do the same directly in Rails4 since this gem is just supposed to be backward compatibility.

Extend concerns to Scopes and Namespaces
As for now routing concerns were only available for resources.
Some people may need it for scopes or namespace to DRY their routes.
@zsombor

This comment has been minimized.

Show comment Hide comment
@zsombor

zsombor Mar 19, 2013

You can have the above without extending the gem or using it at all, with a simple ruby idiom:

def trashable_concerns
  # all the resources and routes that implement trashable
end

scope "comments" do
  trashable_concerns
end

# same with namespaces, resources and the rest 

Just a method definition and subsequent call to it, without the need for looking up the API docs of another construct.

zsombor commented Mar 19, 2013

You can have the above without extending the gem or using it at all, with a simple ruby idiom:

def trashable_concerns
  # all the resources and routes that implement trashable
end

scope "comments" do
  trashable_concerns
end

# same with namespaces, resources and the rest 

Just a method definition and subsequent call to it, without the need for looking up the API docs of another construct.

@paulodeon

This comment has been minimized.

Show comment Hide comment
@paulodeon

paulodeon Jan 14, 2015

The documentation is wrong here:

http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Scoping.html states that "scope(*args)...Takes same options as Base#match and Resources#resources."

It doesn't take the concerns option.

The documentation is wrong here:

http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Scoping.html states that "scope(*args)...Takes same options as Base#match and Resources#resources."

It doesn't take the concerns option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment