Class: Event

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Informatible
Defined in:
app/models/event.rb

Overview

type наименование класса события memory_id id памяти, событие которой произошло place_id id места, где произошло событие item_id id предмета, к которому применяется событие

Constant Summary collapse

USUAL =
[
   'Marriage',
   'Exaltation',
   'Ascension',
   'Restoration',
   'Resurrection',
   'Entrance',
   'Conception',
   'Protection',
   'Conceiving',
   'Writing',
   'Sanctification',
   'Uncovering',
   'Circumcision',
   'Revival',
   'Renunciation',
   'Placing',
   'Translation',
   'Adoration',
   'Transfiguration',
   'Repose',
   'Nativity',
   'Council',
   'Meeting',
   'Passion',
   'Supper',
   'Assurance',
   'Miracle',
   'Appearance',
]

Instance Method Summary collapse

Methods included from Informatible

extended

Instance Method Details

#description_for(language_code) ⇒ Object



66
67
# File 'app/models/event.rb', line 66

def description_for language_code
descriptions.where(language_code: language_code).first ;end

#happened_atObject



88
89
90
# File 'app/models/event.rb', line 88

def happened_at
value = read_attribute(:happened_at)
value.to_s =~ /,/ && value.split(/,\*/) || value ;end

#happened_at=(value) ⇒ Object

serialization



84
85
86
# File 'app/models/event.rb', line 84

def happened_at= value
   value.is_a?(Array) && super(value.join('/')) || super
end

#kind_for(language_code) ⇒ Object



63
64
# File 'app/models/event.rb', line 63

def kind_for language_code
kinds.where(language_code: language_code).first ;end

#kontakions(text_present = true) ⇒ Object



76
77
78
# File 'app/models/event.rb', line 76

def kontakions text_present = true
relation = Kontakion.joins( :services ).where( services: { id: services.pluck( :id ) } )
text_present && relation.where.not( { text: nil } ) || relation ;end

#kontakions_for(language_code, text_present = true) ⇒ Object



80
81
# File 'app/models/event.rb', line 80

def kontakions_for language_code, text_present = true
kontakions( text_present ).where(language_code: language_code) ;end

#troparions(text_present = true) ⇒ Object



69
70
71
# File 'app/models/event.rb', line 69

def troparions text_present = true
relation = Troparion.joins( :services ).where( services: { id: services.pluck( :id ) } )
text_present && relation.where.not( { text: nil } ) || relation ;end

#troparions_for(language_code, text_present = true) ⇒ Object



73
74
# File 'app/models/event.rb', line 73

def troparions_for language_code, text_present = true
troparions( text_present ).where(language_code: language_code) ;end