Class: Character

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

Overview

A character writes pixes, and styles them. The pix heading color comes from the character. Display name is the character's name Handle is the twitter style handle used to refer to the character.

Instance Method Summary collapse

Instance Method Details

#deactivateObject

Deactivate characters so they no longer show on the index page Deactivated characters are still visible and available around the app Pixes can still be created for deactivate characters


33
34
35
# File 'app/models/character.rb', line 33

def deactivate
  update(state: 'inactive')
end

#deactivate_previous_characterObject

When we iterate on a character, we only want to show one character in the index list, so deactivate the old one


40
41
42
# File 'app/models/character.rb', line 40

def deactivate_previous_character
  previous_character&.deactivate
end

#name_and_versionObject

Used in dropdowns to differentiate between characters


46
47
48
# File 'app/models/character.rb', line 46

def name_and_version
  [display_name, version].compact.join(' ')
end