Sha256: c6cb54c52f16d43266d32f193914930198e2cdafae63274ede0c41a6ddde86b5

Contents?: true

Size: 652 Bytes

Versions: 8

Compression:

Stored size: 652 Bytes

Contents

module EffectiveRolesHelper
  # For use in formtastic forms
  def effective_roles_fields(form, user = nil, options = {})
    raise ArgumentError.new('EffectiveRoles config.role_descriptions must be a Hash.  The Array syntax is deprecated.') unless EffectiveRoles.role_descriptions.kind_of?(Hash)

    roles = EffectiveRoles.assignable_roles_for(user, form.object)
    descriptions = EffectiveRoles.role_descriptions[form.object.class.name] || EffectiveRoles.role_descriptions || {}

    opts = {:f => form, :roles => roles, :descriptions => descriptions}.merge(options)

    render :partial => 'effective/roles/roles_fields', :locals => opts
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
effective_roles-1.3.1 app/helpers/effective_roles_helper.rb
effective_roles-1.3.0 app/helpers/effective_roles_helper.rb
effective_roles-1.2.1 app/helpers/effective_roles_helper.rb
effective_roles-1.2.0 app/helpers/effective_roles_helper.rb
effective_roles-1.1.0 app/helpers/effective_roles_helper.rb
effective_roles-1.0.2 app/helpers/effective_roles_helper.rb
effective_roles-1.0.1 app/helpers/effective_roles_helper.rb
effective_roles-1.0.0 app/helpers/effective_roles_helper.rb