Sha256: dfa6331f2f72cab76f945126208426a9b3b0fb2ab88748c84c487ffbfc15d968

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module IamHelper
  def include_iam
    return if Rails.env == 'production'

    @account_samples = account_samples
    stylesheet_link_tag('iam') +
    javascript_include_tag('iam', 'jquery.cookie') +
    render('iam/menu')
  end

  private
  def account_samples
    role_class = Iam::Configuration.role_class.constantize
    account_class = Iam::Configuration.account_class.constantize

    role_class.all.inject({}) do |account_groups, role|
      account_group = account_class.where(role_class.to_s.foreign_key => role.id).order(:id).limit(Iam::Configuration.accounts_for_each_role)
      account_groups.merge role => account_group
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iam-0.1.4 lib/helpers/iam_helper.rb