Module: RolesHelper

Defined in:
app/helpers/roles_helper.rb

Overview

== Schema Information

Table name: roles

id :integer not null, primary key
name :string(255)
is_workgroup :boolean
description :string(255) default(" "), not null
parent_id :integer

Instance Method Summary collapse

Instance Method Details

#role_account_collection_options(accounts_ids = []) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/roles_helper.rb', line 13

def (accounts_ids = [])
	res = Account.joins(:party).
				  where("parties.inactive = false").
				  order("full_name").
				  select("parties.full_name, accounts.id")
	if accounts_ids.present?
		res = res.where("accounts.id IN (?) or parties.type = 'Employee'", accounts_ids)
	else
		res = res.where("parties.type = 'Employee'")
	end
	res.pluck("parties.full_name, accounts.id")
end