mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make named helpers unprotected without becoming actions [#4696 state:resolved]
This commit is contained in:
parent
3adb395da4
commit
eebac02606
2 changed files with 12 additions and 1 deletions
|
@ -16,5 +16,13 @@ module ActionController
|
|||
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
|
|
@ -68,6 +68,10 @@ module ActionDispatch
|
|||
clear!
|
||||
end
|
||||
|
||||
def helper_names
|
||||
self.module.instance_methods.map(&:to_s)
|
||||
end
|
||||
|
||||
def clear!
|
||||
@routes = {}
|
||||
@helpers = []
|
||||
|
@ -176,7 +180,6 @@ module ActionDispatch
|
|||
|
||||
url_for(options)
|
||||
end
|
||||
protected :#{selector}
|
||||
END_EVAL
|
||||
helpers << selector
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue