lib/kojac/kojac_rails.rb in kojac-0.15.0 vs lib/kojac/kojac_rails.rb in kojac-0.16.0
- old
+ new
@@ -624,15 +624,15 @@
resource,action = op[:key].split_kojac_key
raise "action not given" unless action.is_a? String
action = rails_controller? ? "execute_#{action}" : "execute__#{action}"
raise "action #{action} not implemented on #{resource}" unless respond_to? action.to_sym
result = rails_controller? ? send(action.to_sym,op) : send(action)
- error = rails_controller? ? op[:error] : (respond_to?(:error).to_nil && send(:error))
- if error
+ err = rails_controller? ? op[:error] : (respond_to?(:error).to_nil && send(:error))
+ if err
{
key: op[:key],
verb: op[:verb],
- error: error
+ error: err
}
else
result_key = op[:result_key] || op[:key]
results = op[:results] || {} # look at op[:results][result_key]. If empty, fill with returned value from action
results[result_key] = KojacUtils.to_jsono(result,scope: current_user) unless results.has_key? result_key
\ No newline at end of file