Class: GroupOption

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

Constant Summary collapse

EMAIL_MESSAGES =
0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_option_type_label(value) ⇒ String

Finds the label for the option type value set for a given Model

Parameters:

  • value (Integer)

    the option type value

Returns:

  • (String)

    the label



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

def self.find_option_type_label(value)
  option_type_labels.fetch(value.to_sym, nil)
end

.option_type_labelsString

Note:

This should perhaps in the future parse from a YAML config. file

Provides a human-readable label for the type of the option

Returns:

  • (String)

    the label



13
14
15
16
17
# File 'app/models/group_option.rb', line 13

def self.option_type_labels
  {
    email_messages: "E-mail messages for Group notifications"
  }
end

Instance Method Details

#option_type_labelString

Finds the label for the option type

Returns:

  • (String)

    the label



28
29
30
# File 'app/models/group_option.rb', line 28

def option_type_label
  self.class.find_option_type_label(option_type)
end