Forum: Ruby on Rails Helper Classes

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Brian T. (Guest)
on 2005-12-13 01:38
(Received via mailing list)

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 (, 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?
Brian T. (Guest)
on 2005-12-13 01:50
(Received via mailing list)
are included in the ActionView class in the context of the ActionView.

I meant to say

are included in the ActionView object.
This topic is locked and can not be replied to.