Skip to content

Instantly share code, notes, and snippets.

@WizardOfOgz
Created May 29, 2015 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WizardOfOgz/02c0aba02df6216fab38 to your computer and use it in GitHub Desktop.
Save WizardOfOgz/02c0aba02df6216fab38 to your computer and use it in GitHub Desktop.
The best way to use ActionView helpers outside of a view.
::ActionView::Helpers::NumberHelper.instance_method(:number_with_precision).bind(Module.new{ extend ActionView::Helpers::NumberHelper }).call("1234.0", :strip_insignificant_zeros => true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment