Module: PowerResource::CollectionHelper

Defined in:
app/helpers/power_resource/collection_helper.rb

Instance Method Summary collapse

Instance Method Details

#collection_human_nameObject

Returns humanized and localized name for a current collection



9
10
11
12
# File 'app/helpers/power_resource/collection_helper.rb', line 9

def collection_human_name
  I18n.t("activerecord.models.#{resource_name}.other",
    default: collection_name.humanize)
end

#collection_nameObject

Returns a name for a current collection



4
5
6
# File 'app/helpers/power_resource/collection_helper.rb', line 4

def collection_name
  resource_name.tableize
end

#collection_title(options = {}) ⇒ Object

Returns a title for a current collection



15
16
17
18
# File 'app/helpers/power_resource/collection_helper.rb', line 15

def collection_title(options = {})
  I18n.t("power_resource.titles.#{resource_name}.collection",
    { default: "#{collection_human_name}" }.merge(options) )
end