Module: Locomotive::MembershipsHelper

Defined in:
app/helpers/locomotive/memberships_helper.rb

Instance Method Summary collapse

Instance Method Details

#options_for_membership_roles(membership) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/locomotive/memberships_helper.rb', line 4

def options_for_membership_roles(membership)
  current_role = membership.role

  [].tap do |options|
    Locomotive::Membership::ROLES.each do |role|
      membership.role = role
      if policy(membership).change_role?
        options << [t("locomotive.memberships.roles.#{role}"), role.to_s]
      end
    end
    membership.role = current_role
  end
end