mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Be more careful about deducing action_methods
This commit is contained in:
parent
fbc6129acd
commit
165120a606
1 changed files with 10 additions and 6 deletions
|
@ -428,11 +428,7 @@ module ActionController #:nodoc:
|
||||||
# By default, all methods defined in ActionController::Base and included modules are hidden.
|
# By default, all methods defined in ActionController::Base and included modules are hidden.
|
||||||
# More methods can be hidden using <tt>hide_actions</tt>.
|
# More methods can be hidden using <tt>hide_actions</tt>.
|
||||||
def hidden_actions
|
def hidden_actions
|
||||||
unless read_inheritable_attribute(:hidden_actions)
|
read_inheritable_attribute(:hidden_actions) || write_inheritable_attribute(:hidden_actions, [])
|
||||||
write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods.map { |m| m.to_s })
|
|
||||||
end
|
|
||||||
|
|
||||||
read_inheritable_attribute(:hidden_actions)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hide each of the given methods from being callable as actions.
|
# Hide each of the given methods from being callable as actions.
|
||||||
|
@ -1234,7 +1230,15 @@ module ActionController #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.action_methods
|
def self.action_methods
|
||||||
@action_methods ||= Set.new(public_instance_methods.map { |m| m.to_s }) - hidden_actions + public_instance_methods(false).map { |m| m.to_s }
|
@action_methods ||=
|
||||||
|
# All public instance methods of this class, including ancestors
|
||||||
|
public_instance_methods(true).map { |m| m.to_s }.to_set -
|
||||||
|
# Except for public instance methods of Base and its ancestors
|
||||||
|
Base.public_instance_methods(true).map { |m| m.to_s } +
|
||||||
|
# Be sure to include shadowed public instance methods of this class
|
||||||
|
public_instance_methods(false).map { |m| m.to_s } -
|
||||||
|
# And always exclude explicitly hidden actions
|
||||||
|
hidden_actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_variables_to_assigns
|
def add_variables_to_assigns
|
||||||
|
|
Loading…
Reference in a new issue