Module: UsersHelper
- Defined in:
- app/helpers/users_helper.rb
Overview
Helper module for working with users in your application.
Class Method Summary collapse
-
.get_inspectors_names(property_id) ⇒ String
Get the name of the inspector assigned to a specific property.
Class Method Details
.get_inspectors_names(property_id) ⇒ String
Get the name of the inspector assigned to a specific property.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/users_helper.rb', line 9 def self.get_inspectors_names(property_id) #users = User.where(user_type: 'inspector') inspectors_names = [] users = User.where('user_type IN (?)', ['inspector']) users.each do |user| if user[:properties].present? property_ids = user[:properties]['property_ids'].to_s.split(',') property_ids = property_ids.map(&:to_i) if property_ids.present? if property_ids.include? property_id inspectors_names << "#{user.first_name} #{user.last_name}" end end end end inspectors_names end |