Class: NextSgad::Position

Inherits:
ApplicationRecord show all
Defined in:
app/models/next_sgad/position.rb

Constant Summary collapse

INITIAL_LETTER =
"P"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#create_number, #create_number!

Class Method Details

.map_for_filterObject

creates filter data



32
33
34
# File 'app/models/next_sgad/position.rb', line 32

def self.map_for_filter
  [[I18n.t(:everything), :all]] + all.map {|f| [f.name_and_number, f.id]}
end

.map_for_selectObject

creates filter data



27
28
29
# File 'app/models/next_sgad/position.rb', line 27

def self.map_for_select
  all.map {|f| [f.name_and_number, f.id]}
end

.ocupiedObject



18
19
20
# File 'app/models/next_sgad/position.rb', line 18

def self.ocupied
  self.where.not(efective_id: nil)
end

Instance Method Details

#name_and_numberObject



22
23
24
# File 'app/models/next_sgad/position.rb', line 22

def name_and_number
  "#{number} - #{name}"
end