lib/rhoconnect/controller/js_base.rb in rhoconnect-4.0.0 vs lib/rhoconnect/controller/js_base.rb in rhoconnect-4.0.1
- old
+ new
@@ -9,11 +9,11 @@
class JsBase < Rhoconnect::Controller::Base
# Add helpers for deprecated routes
Rhoconnect::DefaultServer.helpers Rhoconnect::Controller::JsBaseHelpers
helpers Rhoconnect::Controller::JsBaseHelpers
- register Rhoconnect::Handler::PluginCallbacks
+ #register Rhoconnect::Handler::PluginCallbacks
# source name is available inherently from controller
before do
params[:source_name] = self.class._rest_name
params[:source_id] = self.class._rest_name
@@ -30,10 +30,15 @@
klass = Object.const_set(controller_name, Class.new(Rhoconnect::Controller::JsBase))
end
Rhoconnect.add_to_url_map(klass)
process_defaults(klass,val['defaults'])
process_routes(klass,val['routes'])
+
+ # add PluginCallback routes (but only for Adapter Controllers)
+ unless controller_name == "ApplicationController"
+ klass.register Rhoconnect::Handler::PluginCallbacks
+ end
end
end
private
@@ -72,10 +77,10 @@
:args => params,
:model => under_score(params[:source_name]),
:route => 'request'
}
json[:user] = @model.current_user.login if @model
- return_value = NodeChannel.publish_channel_and_wait(json,@model)
+ return_value = NodeChannel.publish_channel_and_wait(json,@model || self)
if finish_block
self.send(finish_block, return_value)
else
return_value
end
\ No newline at end of file