Also allow db connections for pre & post.

This commit is contained in:
Martin Edenhofer 2015-11-12 11:28:06 +01:00
parent d9a6c835b0
commit 3602f4f0ea

View file

@ -10,14 +10,19 @@ class Sessions::Event
return { error: "No such event #{event}" } return { error: "No such event #{event}" }
end end
ActiveRecord::Base.establish_connection
instance = backend.new(data, session, client_id) instance = backend.new(data, session, client_id)
pre = instance.pre pre = instance.pre
return pre if pre if pre
ActiveRecord::Base.establish_connection ActiveRecord::Base.remove_connection
return pre
end
result = instance.run result = instance.run
ActiveRecord::Base.remove_connection
post = instance.post post = instance.post
return post if post if post
ActiveRecord::Base.remove_connection
return post
end
result result
end end