Rails plugin that will let you access helpers anywhere
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README.rdoc
Rakefile
init.rb
install.rb
uninstall.rb

README.rdoc

HelpersAnywhere

HelpersAnywhere is a Rails plugin that will let you access helpers anywhere, hence the name. One use case would be to let you use the URL helpers in your rake tasks and mailers.

Caveat emptor: If you feel the need for this, you're quite possibly doing it wrong.

Installation

script/plugin install git://github.com/elektronaut/helpers_anywhere.git

Then add the following line to your initializers:

HelpersAnywhere.default_domain = "mydomain.com"

Usage

Examples:

include HelpersAnywhere

with_helper do
  textilize "Hello world"
  time_ago_in_words(2.days.ago)
  users_url
end

helper.textilize("Hello world!")
helper.time_ago_in_words(2.days.ago)
helper.users_url

You don't have to include the module:

HelpersAnywhere.helper.time_ago_in_words(10.minutes_ago) # => 10 minutes

HelpersAnywhere.with_helper do
  users_url 
end

License

Copyright © 2009 Inge Jørgensen, released under the MIT license