Commit a53aaa49c500d894dc7effde8052878ffe38e1ca
1 parent
692325d6
Exists in
staging
and in
42 other branches
[tolerance-time] Enabling filter hotspot to return a single filter
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -113,7 +113,9 @@ class ApplicationController < ActionController::Base |
113 | 113 | # plugin to the current controller being initialized. |
114 | 114 | def init_noosfero_plugins_controller_filters |
115 | 115 | @plugins.each do |plugin| |
116 | - plugin.send(self.class.name.underscore + '_filters').each do |plugin_filter| | |
116 | + filters = plugin.send(self.class.name.underscore + '_filters') | |
117 | + filters = [filters] if !filters.kind_of?(Array) | |
118 | + filters.each do |plugin_filter| | |
117 | 119 | self.class.send(plugin_filter[:type], plugin.class.name.underscore + '_' + plugin_filter[:method_name], (plugin_filter[:options] || {})) |
118 | 120 | self.class.send(:define_method, plugin.class.name.underscore + '_' + plugin_filter[:method_name], plugin_filter[:block]) |
119 | 121 | end | ... | ... |