Tuesday, February 12, 2008

Make ActionView::Helpers Available To Models And Controllers

Ara T. Howard accomplishes this with some nice handy code; I took it one further, and with his permission, packaged it up as a plugin.

Use cases like

render :text => link_to "foo", "bar"

are impossible in Rails controllers by default; but with this plugin, you can do this:

render :text => helper { link_to "foo", "bar" }

Nice and easy.

Install here:

script/plugin install \
http://universally-available-helpers.googlecode.com/svn/trunk/universally_available_helpers