Commit 13885bd35bb51ee06f8337923e840fa90f10809d

Authored by Victor Costa
Committed by Rodrigo Souto
1 parent 38212a9c

api: fix plugin hotspot

lib/noosfero/api/api.rb
@@ -38,7 +38,7 @@ module Noosfero @@ -38,7 +38,7 @@ module Noosfero
38 #finds for plugins which has api mount points classes defined (the class should extends Grape::API) 38 #finds for plugins which has api mount points classes defined (the class should extends Grape::API)
39 @plugins = Noosfero::Plugin.all.map { |p| p.constantize } 39 @plugins = Noosfero::Plugin.all.map { |p| p.constantize }
40 @plugins.each do |klass| 40 @plugins.each do |klass|
41 - if klass.public_methods.include? 'api_mount_points' 41 + if klass.public_methods.include? :api_mount_points
42 klass.api_mount_points.each do |mount_class| 42 klass.api_mount_points.each do |mount_class|
43 mount mount_class if mount_class && ( mount_class < Grape::API ) 43 mount mount_class if mount_class && ( mount_class < Grape::API )
44 end 44 end
lib/noosfero/plugin.rb
@@ -203,6 +203,7 @@ class Noosfero::Plugin @@ -203,6 +203,7 @@ class Noosfero::Plugin
203 203
204 # -> define grape class used to map resource api provided by the plugin 204 # -> define grape class used to map resource api provided by the plugin
205 def api_mount_points 205 def api_mount_points
  206 + []
206 end 207 end
207 end 208 end
208 209