Class: User
Constant Summary collapse
- DEFAULT_NAME =
'Guest'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.include_name ⇒ Object
12 13 14 15 16 17 |
# File 'app/models/user.rb', line 12 def self.include_name field :name validates_presence_of :name validates_format_of :name, without: /^\s*$/ validates_uniqueness_of :name end |
Instance Method Details
#reset_hotkeys! ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/models/user.rb', line 21 def reset_hotkeys! hotkeys.delete_all Hotkey::DEFAULT_HOTKEYS.each do |action, key| hotkeys.create! action: action, key: key end save! self end |