[Dry::View] 0.3.0 broke our templating - help needed to understand



Since the 0.3.0 update of the dry-view gem, our templating is broken. The context provided is not used anymore.
Here is a small gist to show what we try to do and how we try to do it. If you run this with the 0.2.2 version, it works. With the 0.3.0 version, it doesn’t.

Could someone give us a hint as to why it doesn’t work anymore?




Hi Simon,

In 0.3.0, we only look for methods on the context object. If you changed your example’s context object to something like this:

require "ostruct"

options = {:context => OpenStruct.new('name':'John', 'email':'john@doe.com'), :lang => 'en-GB', :template => 'basictemplate'}

Does it work?


Hi Tim,

I’m afraid it doesn’t.
I updated the gist (https://gist.github.com/simongareste/d32b8bc6abac4db052159f222d2d50a6), still no success.

Could you explain a bit (or point to explanations) on the “we only look for methods on the context object.” ?
You mean that I should have for example context.name (which is a method of the context) instead of context[:name] (where name is a property of the context) ? That’s why you suggested openstruct? If so, I would say that indeed, using openstruct works in the way that context.name works, but it doesn’t change the result.