Rails: Why is the "number_with_delimiter" method not recognized inside my model?
You should use extend:
Usage: extend ActionView::Helpers::NumberHelper
It is good for me
The true problem here is that you're including this module into the class, rather than extended the class with it.
The differences is an include will make the methods available on the instance, where as the extend will make them where you're trying to use them: on the class.
For instance method use
include ActionView::Helpers::NumberHelper
For class method use
extend ActionView::Helpers::NumberHelper
You might be missing the dependency... is the NumberHelper class accessible to your application?
Check the official Rails docs
Instead of extending ActionView
module. You can use methods from ActiveSupport
instead
For example:
ActiveSupport::NumberHelper::number_to_currency(10000.1234,{precision: 2,unit: ''})