aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rwxr-xr-xactionpack/lib/action_controller/base.rb12
-rw-r--r--actionpack/lib/action_controller/filters.rb16
2 files changed, 18 insertions, 10 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index dd50f17c1c..9d9ff527c2 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -412,7 +412,7 @@ module ActionController #:nodoc:
# More methods can be hidden using <tt>hide_actions</tt>.
def hidden_actions
unless read_inheritable_attribute(:hidden_actions)
- write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods.map(&:to_s))
+ write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods.map { |m| m.to_s })
end
read_inheritable_attribute(:hidden_actions)
@@ -420,12 +420,12 @@ module ActionController #:nodoc:
# Hide each of the given methods from being callable as actions.
def hide_action(*names)
- write_inheritable_attribute(:hidden_actions, hidden_actions | names.map(&:to_s))
+ write_inheritable_attribute(:hidden_actions, hidden_actions | names.map { |name| name.to_s })
end
- ## View load paths determine the bases from which template references can be made. So a call to
- ## render("test/template") will be looked up in the view load paths array and the closest match will be
- ## returned.
+ # View load paths determine the bases from which template references can be made. So a call to
+ # render("test/template") will be looked up in the view load paths array and the closest match will be
+ # returned.
def view_paths
@view_paths || superclass.view_paths
end
@@ -1201,7 +1201,7 @@ module ActionController #:nodoc:
end
def self.action_methods
- @action_methods ||= Set.new(public_instance_methods.map(&:to_s)) - hidden_actions
+ @action_methods ||= Set.new(public_instance_methods.map { |m| m.to_s }) - hidden_actions
end
def add_variables_to_assigns
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb
index 155d8b480a..c3f1de971e 100644
--- a/actionpack/lib/action_controller/filters.rb
+++ b/actionpack/lib/action_controller/filters.rb
@@ -127,9 +127,9 @@ module ActionController #:nodoc:
def included_in_action?(controller, options)
if options[:only]
- Array(options[:only]).map(&:to_s).include?(controller.action_name)
+ Array(options[:only]).map { |o| o.to_s }.include?(controller.action_name)
elsif options[:except]
- !Array(options[:except]).map(&:to_s).include?(controller.action_name)
+ !Array(options[:except]).map { |o| o.to_s }.include?(controller.action_name)
else
true
end
@@ -544,13 +544,21 @@ module ActionController #:nodoc:
# Returns all the before filters for this class and all its ancestors.
# This method returns the actual filter that was assigned in the controller to maintain existing functionality.
def before_filters #:nodoc:
- filter_chain.select(&:before?).map(&:method)
+ filters = []
+ filter_chain.each do |filter|
+ filters << filter.method if filter.before?
+ end
+ filters
end
# Returns all the after filters for this class and all its ancestors.
# This method returns the actual filter that was assigned in the controller to maintain existing functionality.
def after_filters #:nodoc:
- filter_chain.select(&:after?).map(&:method)
+ filters = []
+ filter_chain.each do |filter|
+ filters << filter.method if filter.after?
+ end
+ filters
end
end