Helper methods are currently implemented as modules that, I assume, are
included in the ActionView class in the context of the ActionView.
This is fine for simple views, but it seems like it may cause problems
the views get more complicated.
Some tight coupling will start to happen If the helper grows and grows
gets a bunch of methods. You could move some of the methods to another
helper module, but the object still has all of the methods. This would
it more difficult to unit test the helper since there is potentially
tight coupling going on.
Also, there is the possibility of name collision. One can start pluggin
one of the many 3rd party helpers (
http://wiki.rubyonrails.com/rails/pages/3rd+Party+Helpers), but what if
of the 3rd party modules have the method :render_this?
I think making the helpers into classes would solve these issues, for
same reasons why object oriented code handles complexity better than
procedural oriented code.
Has anybody used Helper Classes? If so, what is a Rails friendly
of doing so? For example, would the helper classes go into the
directory or in the same directory as the view (app/views/viewname)?
Are there any examples out there?