Also allow db connections for pre & post.
This commit is contained in:
parent
d9a6c835b0
commit
3602f4f0ea
1 changed files with 9 additions and 4 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue