Commit 1098be610d999b0a54c80a299a69453dd8f1e7b5
1 parent
9593b2d9
Exists in
master
and in
28 other branches
Replacing scary eval's with String#constantize
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/controllers/admin/plugins_controller.rb
| 1 | class PluginsController < AdminController | 1 | class PluginsController < AdminController |
| 2 | 2 | ||
| 3 | def index | 3 | def index |
| 4 | - @active_plugins = Noosfero::Plugin.all.map {|plugin_name| eval(plugin_name)}.compact | 4 | + @active_plugins = Noosfero::Plugin.all.map {|plugin_name| plugin_name.constantize }.compact |
| 5 | end | 5 | end |
| 6 | 6 | ||
| 7 | post_only :update | 7 | post_only :update |
lib/noosfero/plugin/manager.rb
| @@ -12,7 +12,7 @@ class Noosfero::Plugin::Manager | @@ -12,7 +12,7 @@ class Noosfero::Plugin::Manager | ||
| 12 | 12 | ||
| 13 | def enabled_plugins | 13 | def enabled_plugins |
| 14 | @enabled_plugins ||= (Noosfero::Plugin.all & context.environment.enabled_plugins).map do |plugin| | 14 | @enabled_plugins ||= (Noosfero::Plugin.all & context.environment.enabled_plugins).map do |plugin| |
| 15 | - p = eval(plugin).new | 15 | + p = plugin.constantize.new |
| 16 | p.context = context | 16 | p.context = context |
| 17 | p | 17 | p |
| 18 | end | 18 | end |