Next-gen ruby libs! » github.com/dry-rb » website: https://dry-rb.org » forum: https://discourse.dry-rb.org
context
to default_context
is 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
gem install dry-web-roda
, then dry-web-roda new dwr_test
, then cd dwr_test
and then bundle install
. What currently works for me is forcing dry-view
to be below 5.x, in the gemfile: gem "dry-view", "~> 0.4", "< 0.5"
"< 0.5"
is my addition, without it it didn't work
FooAction.new.call(args)
- even if I can override the initialize
method, 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
FooService.new.do_stuff(params)
?
allow_any_instance_of
, which gives you the ability to unit test nevertheless. In Scala, for example, this is simply not possible... you just can't do that, so people don't.