Sha256: 04add0be705748d08e5d59396a617df1d3edbb01b94a77731524e150d9ec6c96

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

module PowerResource
  module CollectionHelper
    # Returns a name for a current collection
    def collection_name
      resource_name.tableize
    end

    # Returns humanized and localized name for a current collection
    def collection_human_name
      I18n.t("activerecord.models.#{resource_name}.other",
        default: collection_name.humanize)
    end
    
    # Returns a title for a current collection
    def collection_title(options = {})
      I18n.t("power_resource.titles.#{resource_name}.collection",
        { default: "#{collection_human_name}" }.merge(options) )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
power_resource-0.0.3 app/helpers/power_resource/collection_helper.rb
power_resource-0.0.2 app/helpers/power_resource/collection_helper.rb