flash-gordon on master
Fix error on Dry::Types::Array#… Merge pull request #366 from es… (compare)
solnic on master
Adding missing built-in predica… Merge pull request #65 from esp… Merge branch 'release-1.0' (compare)
solnic on release-1.0
Adding missing built-in predica… Merge pull request #65 from esp… (compare)
default_contextis something I already tried after sniffing around a bit in debug mode and just trying things out, but it leads to another error:
NoMethodError: undefined method `for_rendering' for #<DwrTest::Main::View::Context:0x00007fd53fc59f38> /Users/eliavlavi/.rvm/gems/ruby-2.5.3/gems/dry-view-0.5.4/lib/dry/view/rendering.rb:23:in `initialize' /Users/eliavlavi/.rvm/gems/ruby-2.5.3/gems/dry-view-0.5.4/lib/dry/view/rendering.rb:7:in `new' /Users/eliavlavi/.rvm/gems/ruby-2.5.3/gems/dry-view-0.5.4/lib/dry/view/rendering.rb:7:in `prepare' ... 127.0.0.1 - - [18/Jan/2019:10:47:25 +0200] "GET / HTTP/1.1" 500 151990 0.0265
"< 0.5"is my addition, without it it didn't work
FooAction.new.call(args)- even if I can override the
initializemethod, as they describe, this is not how I want to do it, I want to have a single instance of those classes and just pass data through them.
Minimise the number of places I have to look to understand what's going on in an individual piece of code.
...without burying me in a five-hundred-line piece of code with a score or three private methods, like too many Rails controllers I've had to do chainsaw surgery on over the years
Any idea how to make this work?
require "dry/container" module Core class Container extend Dry::Container::Mixin register("transaction") do |input, &block| result = nil begin ActiveRecord::Base.transaction do result = block.call(Dry::Monads::Success(input)) raise ActiveRecord::Rollback if result.failure? result end rescue ActiveRecord::Rollback require "pry"; binding.pry result end end end end
I'm getting the following error:
Dry::Transaction::InvalidResultError: step +transaction+ must return a Result object
I guess because the
ActiveRecord::Rollback is not being rescued.