Module: PricesHelper

Defined in:
app/helpers/prices_helper.rb

Instance Method Summary collapse

Instance Method Details

#formatted_static_price(price, params = {}, curr = nil) ⇒ Object



4
5
6
7
8
9
# File 'app/helpers/prices_helper.rb', line 4

def formatted_static_price(price, params = {}, curr = nil)
  rate = TranslationCms::Api::Rates::Currency.all!.detect { |c| c.currency == curr } if curr.present?
  rate ||= TranslationCms::Api::Rates::Currency.all!.first
  params[:precision] ||= 2
  I18n.t(:currency, scope: [:new_order, :title]) + number_with_precision((price || 0) * (rate.value || 1), params)
end