Each of these consist of a mixin for controllers, a number view templates stored inside the plugin, and a helper for use by those views.
The module mixed into ActionController::Base provides a declarative way of defining all the actions involved at once, inside any controller we want. This might, for instance, look something like:
folder_for :student do
tabs :general, :attendance, :surveys
tab :report do
# get report data
end
end
This declarative method would handle defining each action, and determining what data needs to be prepared for each action, acting somewhat like a before_filter, and then render the appropriate views stored inside the plugin (via render :file).
Sure, you could do all of this be defining the controller part in application.rb, manually attaching the helper, and having some type of cross-controller template directory to store its views … but this way certainly feels cleaner, and who knows if we might want to reuse the code (or even just the concept) in another application?
Putting stuff in plugins is worth it — if even just to make things easier to find in your own application.
One of the techniques we’ve been using at work to develop our Rails application is based on the Rails plugin system.
There are several UI components of our application that are a mix of Controller and View pieces. Rather than have each of these strung out across the Rails framework, we package them in plugins.
Even though we’re not distributing these, they’re large enough and used often enough in our application for the separate packaging to really pay off.