Closed joemsak closed 3 years ago
first note on things to add / put back better: errors, working with activerecord errors (converting to lev), handlers, lev_form_for.
Also, finishing up ability to kill a background job would be good.
@jpslav Errors work begun with spec/errors_spec.rb
, lib/lev/errors.rb
, lib/lev/errors/error.rb
, and #transfer_errors_from
#fatal_error
and #nonfatal_error
in lib/lev/routine.rb
Feel free to let me know how I can make it more robust. I'm pretty sure #errors
should just be the collection of Error
instances instead of the #to_s
version, but I thought this was a good first step
Currently lev's fatal_error
won't actually rollback the DB state if the lev routine is called from inside a non-lev transaction. We could potentially either use requires_new: true
when creating the transaction (in which case Lev should rollback its own internal state but not the outer transaction) or, if we want to rollback the entire thing, have Lev raise its own class of rollback error and/or maybe monkeypatch ActiveRecord::Transaction to rollback properly when that error is caught.
This is because Lev raises ActiveRecord::Rollback
, which is caught and silently ignored by nested transactions: http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html#module-ActiveRecord::Transactions::ClassMethods-label-Nested+transactions
OBE
outputs
option which must declare all outputs and their sourcesset
function which sets the attributes mentioned in the outputs maprun
it sets all mapped attributes automatically