Commit e7b77af425454feb7e2e2f168b9b72bab6e154f9
1 parent
77064dd3
Exists in
master
and in
29 other branches
plugins: Do not redeclare routes constant inside loop
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
lib/noosfero/plugin/routes.rb
1 | 1 | plugins_root = Rails.env.test? ? 'plugins' : '{baseplugins,config/plugins}' |
2 | +prefixes_by_folder = {public: 'plugin', | |
3 | + profile: 'profile/:profile/plugin', | |
4 | + myprofile: 'myprofile/:profile/plugin', | |
5 | + admin: 'admin/plugin'} | |
2 | 6 | |
3 | 7 | Dir.glob(Rails.root.join(plugins_root, '*', 'controllers')) do |controllers_dir| |
4 | - prefixes_by_folder = {'public' => 'plugin', | |
5 | - 'profile' => 'profile/:profile/plugin', | |
6 | - 'myprofile' => 'myprofile/:profile/plugin', | |
7 | - 'admin' => 'admin/plugin'} | |
8 | 8 | plugin_name = File.basename(File.dirname(controllers_dir)) |
9 | 9 | |
10 | 10 | controllers_by_folder = prefixes_by_folder.keys.inject({}) do |hash, folder| | ... | ... |