Class: Railscope::Entry
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Railscope::Entry
- Defined in:
- app/models/railscope/entry.rb
Class Method Summary collapse
- .find_by_uuid(uuid) ⇒ Object
-
.find_by_uuid!(uuid) ⇒ Object
Find by UUID (public identifier).
Instance Method Summary collapse
-
#batch_entries ⇒ Object
Get all related entries in the same batch.
-
#family_count ⇒ Object
Count of similar entries (same family_hash).
-
#family_entries ⇒ Object
Get all entries with the same family_hash.
Methods inherited from ApplicationRecord
Class Method Details
.find_by_uuid(uuid) ⇒ Object
28 29 30 |
# File 'app/models/railscope/entry.rb', line 28 def self.find_by_uuid(uuid) find_by(uuid: uuid) end |
.find_by_uuid!(uuid) ⇒ Object
Find by UUID (public identifier)
24 25 26 |
# File 'app/models/railscope/entry.rb', line 24 def self.find_by_uuid!(uuid) find_by!(uuid: uuid) end |
Instance Method Details
#batch_entries ⇒ Object
Get all related entries in the same batch
33 34 35 36 37 |
# File 'app/models/railscope/entry.rb', line 33 def batch_entries return self.class.none if batch_id.blank? self.class.for_batch(batch_id).where.not(id: id).order(:occurred_at) end |
#family_count ⇒ Object
Count of similar entries (same family_hash)
47 48 49 50 51 |
# File 'app/models/railscope/entry.rb', line 47 def family_count return 0 if family_hash.blank? self.class.for_family(family_hash).count end |
#family_entries ⇒ Object
Get all entries with the same family_hash
40 41 42 43 44 |
# File 'app/models/railscope/entry.rb', line 40 def family_entries return self.class.none if family_hash.blank? self.class.for_family(family_hash).where.not(id: id).recent end |