I know this seems silly, but I would like to call some of Rails' Text Helpers in a rake task I am setting up. (Thinks like the pluralize and cycle method: http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html)
How would you go about making these available in a rake task, or is it not easily possible?
It's rather messy to extend ActionView::Helpers in your rake task - that basically includes all helper methods in your Rake task.
ActionController::Base.helpers.pluralize(5, 'dog')
If you don't have a count and you just want to pluralize a word:
ActiveSupport::Inflector.pluralize('dog')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With