Class | Department
In: | app/models/department.rb
Parent: | Organization

Clase para los departamentos en los que se pueden clasificar los News y Events

### Methods

grouped_options label tag_names

### Public Class methods

grouped_options()

Array de departamentos en formato óptimo para hacer un select en un view

[Source]

        # File app/models/department.rb, line 17
    17:   def self.grouped_options
    18:     opts = []
    19:     self.find(:all, :order => "coalesce(internal_id,0)").each do |dept|
    20:       opts.push [[dept.name_es, dept.id], dept.organizations.map {|d| [d.name_es, d.id]}]
    21:     end
    22:     opts
    23:   end

tag_names()

Cada departamento tiene asociado un tag oculto que se añade automáticamente

[Source]

        # File app/models/department.rb, line 12
    12:   def self.tag_names
    13:     self.find(:all, :select => "tag_name").map {|d| d.tag_name}
    14:   end

### Public Instance methods

label()

[Source]

       # File app/models/department.rb, line 7
    7:   def label
    8:     self.tag_name.gsub(/^_+/,'')
    9:   end

[Validate]