I am using "number_with_precision" method in Rails View, it is working fine there, for example:
In Rails View: (works fine)
<%= number_with_precision(job.company.rating, :precision => 2) %>
But when I try to do the same in ApplicationHelper's method then it gives me the following error:
undefined method `number_with_precision' rails
Here is what I have tried:
In Rails ApplicationHelper: (gives error)
module ApplicationHelper
def employer_overall_rating(overall_rating)
@overall_rating = number_with_precision(overall_rating, :precision => 2)
end
end
How can I use the same in ApplicationHelper?
include ActionView::Helpers::NumberHelper
in your application_helper.rb ? – Postriderhelper.number_with_precision(overall_rating, :precision => 2)
– Opinionative