Skip to content

Commit

Permalink
Make named helpers unprotected without becoming actions [#4696 state:…
Browse files Browse the repository at this point in the history
…resolved]
  • Loading branch information
wycats committed Jun 7, 2010
1 parent 3adb395 commit eebac02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions actionpack/lib/action_controller/metal/url_for.rb
Expand Up @@ -16,5 +16,13 @@ def _router
raise "In order to use #url_for, you must include the helpers of a particular " \
"router. For instance, `include Rails.application.routes.url_helpers"
end

module ClassMethods
def action_methods
@action_methods ||= begin
super - _router.named_routes.helper_names
end
end
end
end
end
5 changes: 4 additions & 1 deletion actionpack/lib/action_dispatch/routing/route_set.rb
Expand Up @@ -68,6 +68,10 @@ def initialize
clear!
end

def helper_names
self.module.instance_methods.map(&:to_s)
end

def clear!
@routes = {}
@helpers = []
Expand Down Expand Up @@ -176,7 +180,6 @@ def #{selector}(*args)
url_for(options)
end
protected :#{selector}
END_EVAL
helpers << selector
end
Expand Down

0 comments on commit eebac02

Please sign in to comment.