Class: Note
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Note
- Defined in:
- app/models/note.rb
Instance Method Summary collapse
Instance Method Details
#auto_set_value ⇒ Object
14 15 16 17 18 19 |
# File 'app/models/note.rb', line 14 def auto_set_value unless body.blank? self.title = body.split("\n").first[0..50] self.word_count = body.length end end |
#display_title ⇒ Object
27 28 29 |
# File 'app/models/note.rb', line 27 def display_title (title || '').gsub(/^[\#]+/, '') end |
#update_changes_count ⇒ Object
22 23 24 25 |
# File 'app/models/note.rb', line 22 def update_changes_count self.changes_count = 0 if changes_count.blank? increment(:changes_count) end |