I need a very small Rails example done on how to succesfully use the [url removed, login to view] method from within a Presenter initialized from a controller, and used in a HAML view.
The Presenter must be a subclass of a Draper Decorator ([url removed, login to view]):
So to sum up:
In the controller:
@presenter = SomePresenter::new(view_context)
In the Presenter:
class SomePresenter < ApplicationDecorator
[url removed, login to view]("a_key") do
And in the HAML view:
%h1 = @presenter.some_method
This gives me this error: "You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating [url removed, login to view]"
I need to be able to call cache and return the content to HAML from SomePresenter.
See also my Stack Overflow question on this: [url removed, login to view]
Note that monkey patching either Draper or Rails is not an option to solve this. It must be solved completely by the Presenter class, and must use a presenter initialized in a controller, inheriting from Draper, and used in a HAML view.
The solution to this does not need to be private only to me. I just need the solution. A public git project that shows how to do this, and works, is fine and will be paid.
I have created a git repository to start from that shows my problem and what I want to do: