Skip to content

Instantly share code, notes, and snippets.

@jackboberg
Created December 27, 2012 16:24
Show Gist options
  • Save jackboberg/4389568 to your computer and use it in GitHub Desktop.
Save jackboberg/4389568 to your computer and use it in GitHub Desktop.
Accessing Rails Helpers in Rake Tasks
# lib/tasks/helper_task.rake
namespace :helper do
desc 'Access helper methods in rake tasks'
task :test => :environment do
include ActionView::Helpers
include ApplicationHelper
puts display_amount 2500 #=> "$2,500"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment