Module: LimitsHelper

Defined in:
app/helpers/limits_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_percentage(limit, account) ⇒ Object



2
3
4
# File 'app/helpers/limits_helper.rb', line 2

def current_percentage(limit, )
  number_to_percentage((limit.current_count().to_f / limit.value) * 100)
end

#render_limit_meter(limit) ⇒ Object



6
7
8
9
10
11
12
# File 'app/helpers/limits_helper.rb', line 6

def render_limit_meter(limit)
  if FileTest.exist?(File.join(Rails.root, 'app', 'views', 'limits' , "_#{limit.name}_meter.html.erb"))
    render "limits/#{limit.name}_meter", :limit => limit
  else
    render "limits/meter", :limit => limit
  end
end