Class: Naf::Application
- Defined in:
- app/models/naf/application.rb
Class Method Summary collapse
Instance Method Summary collapse
- #last_queued_job ⇒ Object
- #short_name_if_it_exist ⇒ Object
-
#to_s ⇒ Object
————————- *** Instance Methods *** +++++++++++++++++++++++++.
Methods inherited from NafBase
Class Method Details
.pickleables(pickler) ⇒ Object
76 77 78 |
# File 'app/models/naf/application.rb', line 76 def self.pickleables(pickler) self.where(deleted: false) end |
Instance Method Details
#last_queued_job ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'app/models/naf/application.rb', line 63 def last_queued_job last_queued_job = ::Naf::HistoricalJob. queued_between(Time.zone.now - Naf::HistoricalJob::JOB_STALE_TIME, Time.zone.now). where(application_id: self.id). group(:application_id). select("application_id, MAX(id) AS id").first last_queued_job ? Naf::HistoricalJob.find(last_queued_job.id) : nil end |
#short_name_if_it_exist ⇒ Object
72 73 74 |
# File 'app/models/naf/application.rb', line 72 def short_name_if_it_exist short_name || title end |
#to_s ⇒ Object
*** Instance Methods *** +++++++++++++++++++++++++
54 55 56 57 58 59 60 61 |
# File 'app/models/naf/application.rb', line 54 def to_s components = [] components << "DELETED" if deleted components << "id: #{id}" components << title return "::Naf::Application<#{components.join(', ')}>" end |