PS: This started as a personal conversation with Nick Sutterer and
Aaron Patterson, but I am sending to this mailing list as I think
others may find this information useful.

Nick, I could not control myself and pushed some initial code about
what we discussed. ;)

Yehuda have already started and defined some time ago a module called
ActionView::Context. If you want to behave as an ActionView::Context,
all you need to do is to include this module:

https://github.com/rails/rails/blob/master/actionpack/lib/action_view/context.rb

In order to make this context as slim as possible, I have created the
view_renderer (as we discussed):

https://github.com/rails/rails/blob/master/actionpack/lib/action_view/renderer/renderer.rb

Which is now used in the controller:

https://github.com/rails/rails/blob/master/actionpack/lib/abstract_controller/rendering.rb#L134

And here is an example of what is needed to render a controller
sinatra style:

https://github.com/rails/rails/blob/master/actionpack/test/controller/new_base/render_context_test.rb#L10-18

There is still a lot more to decouple:

1) There is still some controller - view context - view renderer
coupling to iron out (but not a lot).
2) Test cases (AC::TestCase and AV::TestCase are extremely coupled).
Particularly, AV::TestCase should be able to run against a minimal
AV::Context.
3) Helpers are extremely coupled. If you try to use just one of the
helpers in isolation, let's say AV::Helpers::FormHelper, it is likely
that it will fail because it does not have many dependencies. Ideally,
we would use ActiveSupport::Concern and make such dependencies
explicit, as happens in ActionController modules.


José Valim
www.plataformatec.com.br
Founder and Lead Developer

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to