We need to be able to let draper get a copy of the view_context
no matter what happens. AC::Base doesn't really let us do that. So
we have to monkeypatch.
This was originally suggested in
https://github.com/jcasimir/draper/issues/124#issuecomment-6954291
by @rf-.
It appears to be the cleanest way to take care of this problem, and
shouldn't affect any other things, since we keep the exact same
semantics of view_context.
Theoretically:
Fixes#124Fixes#109
Lots of changes here:
* rake draper:install no longer needed
* don't generate an ApplicationGenerator by default
** If one exists, the generator respects it
* Fixes#53
The goal here is to improve ActiveModel support so that Draper can
work seamlessly with Rails' FormHelpers, proxying the model's #errors
method.
I also added support for ActiveModel::Errors, adding a proxy to the
model's #errors method only if it's a descendant of
ActiveModel::Validations.
Also some refactoring was done. Draper now proxies #to_param and #id
methods only if the model is an ActiveModel descendant.
Other things I did include:
- created Draper::ActiveModelSupport::Proxies, which contains the
methods for proxying default methods(to_param, id, etc) depending
on the ancestors
- wrote specs for class with ActiveModel as ancestor
- wrote specs for class without ActiveModel as ancestor