Module: NumbersHelper

Defined in:
app/helpers/numbers_helper.rb

Instance Method Summary collapse

Instance Method Details

#limited_counter_with_delimiter(resource, **options) ⇒ Object


4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/numbers_helper.rb', line 4

def limited_counter_with_delimiter(resource, **options)
  limit = options.fetch(:limit, 1000).to_i
  count = resource.page.total_count_with_limit(:all, limit: limit)

  if count > limit
    number_with_delimiter(count - 1, options) + '+'
  else
    number_with_delimiter(count, options)
  end
end