Class: TranslationCenter::ActivityQuery
- Inherits:
-
Object
- Object
- TranslationCenter::ActivityQuery
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion
- Defined in:
- app/models/translation_center/activity_query.rb
Instance Attribute Summary collapse
-
#created_at_gteq ⇒ Object
Returns the value of attribute created_at_gteq.
-
#created_at_lteq ⇒ Object
Returns the value of attribute created_at_lteq.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#translation_key_name ⇒ Object
Returns the value of attribute translation_key_name.
-
#translator_identifier ⇒ Object
Returns the value of attribute translator_identifier.
Instance Method Summary collapse
-
#activities ⇒ Object
retuns and ActiveRecord Relation of Audit(s) that matches this search criteria.
-
#initialize(args = {}) ⇒ ActivityQuery
constructor
A new instance of ActivityQuery.
- #persisted? ⇒ Boolean
Constructor Details
#initialize(args = {}) ⇒ ActivityQuery
Returns a new instance of ActivityQuery.
12 13 14 15 16 17 |
# File 'app/models/translation_center/activity_query.rb', line 12 def initialize args={} args ||= {} args.each do |k,v| instance_variable_set("@#{k}", v) unless v.blank? end end |
Instance Attribute Details
#created_at_gteq ⇒ Object
Returns the value of attribute created_at_gteq.
6 7 8 |
# File 'app/models/translation_center/activity_query.rb', line 6 def created_at_gteq @created_at_gteq end |
#created_at_lteq ⇒ Object
Returns the value of attribute created_at_lteq.
6 7 8 |
# File 'app/models/translation_center/activity_query.rb', line 6 def created_at_lteq @created_at_lteq end |
#lang ⇒ Object
Returns the value of attribute lang.
6 7 8 |
# File 'app/models/translation_center/activity_query.rb', line 6 def lang @lang end |
#translation_key_name ⇒ Object
Returns the value of attribute translation_key_name.
6 7 8 |
# File 'app/models/translation_center/activity_query.rb', line 6 def translation_key_name @translation_key_name end |
#translator_identifier ⇒ Object
Returns the value of attribute translator_identifier.
6 7 8 |
# File 'app/models/translation_center/activity_query.rb', line 6 def translator_identifier @translator_identifier end |
Instance Method Details
#activities ⇒ Object
retuns and ActiveRecord Relation of Audit(s) that matches this search criteria
20 21 22 23 24 25 |
# File 'app/models/translation_center/activity_query.rb', line 20 def activities query = Audited::Adapters::ActiveRecord::Audit.where(auditable_id: translation_ids).scoped query = query.where("DATE(created_at) <= DATE(?)", created_at_lteq) unless created_at_lteq.blank? query = query.where("DATE(created_at) >= DATE(?)", created_at_gteq) unless created_at_gteq.blank? query.order('created_at DESC') end |
#persisted? ⇒ Boolean
8 9 10 |
# File 'app/models/translation_center/activity_query.rb', line 8 def persisted? false end |