Created
December 27, 2012 16:24
-
-
Save jackboberg/4389568 to your computer and use it in GitHub Desktop.
Accessing Rails Helpers in Rake Tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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