Class: InboxItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- InboxItem
- Includes:
- AASM
- Defined in:
- app/models/inbox_item.rb
Instance Attribute Summary collapse
-
#convert ⇒ Object
Returns the value of attribute convert.
-
#date ⇒ Object
Returns the value of attribute date.
-
#log_time ⇒ Object
Returns the value of attribute log_time.
-
#log_type ⇒ Object
Returns the value of attribute log_type.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#convert ⇒ Object
Returns the value of attribute convert.
10 11 12 |
# File 'app/models/inbox_item.rb', line 10 def convert @convert end |
#date ⇒ Object
Returns the value of attribute date.
10 11 12 |
# File 'app/models/inbox_item.rb', line 10 def date @date end |
#log_time ⇒ Object
Returns the value of attribute log_time.
10 11 12 |
# File 'app/models/inbox_item.rb', line 10 def log_time @log_time end |
#log_type ⇒ Object
Returns the value of attribute log_type.
10 11 12 |
# File 'app/models/inbox_item.rb', line 10 def log_type @log_type end |
#project_id ⇒ Object
Returns the value of attribute project_id.
10 11 12 |
# File 'app/models/inbox_item.rb', line 10 def project_id @project_id end |
Class Method Details
.unconverted ⇒ Object
51 52 53 |
# File 'app/models/inbox_item.rb', line 51 def self.unconverted where(aasm_state: ['unread', 'read']) end |
.unread ⇒ Object
47 48 49 |
# File 'app/models/inbox_item.rb', line 47 def self.unread where(aasm_state: 'unread') end |
Instance Method Details
#do_conversion ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/inbox_item.rb', line 27 def do_conversion transaction do project = user.projects.find(project_id) l = project.log_entries.build({ user_id: user.id, log_time: self.log_time, date: self.date, log_type: self.log_type, task_name: self.subject, task_description: self.body, technical_risks: project.technical_risks }) l.save! update_attribute(:log_entry_id, l.id) file_uploads.update_all(log_entry_id: l.id) end end |
#title ⇒ Object
55 56 57 |
# File 'app/models/inbox_item.rb', line 55 def title subject end |