Class: MenuOption
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MenuOption
- Defined in:
- app/models/menu_option.rb
Overview
A simple class to manage menu options, usable by other classes to build their menus.
Class Method Summary collapse
-
.fetch_values(key) ⇒ Object
A direct SQL selection of values for a given key.
- .keys ⇒ Object
Instance Method Summary collapse
-
#role ⇒ Object
For e9 admin.
- #to_s ⇒ Object
Class Method Details
.fetch_values(key) ⇒ Object
A direct SQL selection of values for a given key
MenuOption.fetch('Email') #=> ['Personal','Work']
Parameters
- key (String)
-
The key for the assocated menu options.
28 29 30 |
# File 'app/models/menu_option.rb', line 28 def self.fetch_values(key) connection.send(:select_values, (key).select('value').order(:position).to_sql, 'Menu Option Select') end |
.keys ⇒ Object
6 7 8 |
# File 'app/models/menu_option.rb', line 6 def self.keys @@keys || [] end |
Instance Method Details
#role ⇒ Object
For e9 admin
37 |
# File 'app/models/menu_option.rb', line 37 def role; 'administrator' end |
#to_s ⇒ Object
32 33 34 |
# File 'app/models/menu_option.rb', line 32 def to_s value end |