Class: Revelry::Content::PseudoContentVersion

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/revelry/content/content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'app/models/revelry/content/content.rb', line 3

def id
  @id
end

#modelObject

Returns the value of attribute model.



3
4
5
# File 'app/models/revelry/content/content.rb', line 3

def model
  @model
end

#rollback_version_idObject

Returns the value of attribute rollback_version_id.



3
4
5
# File 'app/models/revelry/content/content.rb', line 3

def rollback_version_id
  @rollback_version_id
end

Instance Method Details

#as_json(opts = {}) ⇒ Object



29
30
31
32
33
# File 'app/models/revelry/content/content.rb', line 29

def as_json(opts = {})
  Jbuilder.new do |json|
    json.(self, :id, :item_type, :item_id, :event, :whodunnit, :rollback_version_id, :created_at, :reify, :errors)
  end.attributes!
end

#created_atObject



25
26
27
# File 'app/models/revelry/content/content.rb', line 25

def created_at
  model.updated_at + 1.second
end

#eventObject



9
10
11
# File 'app/models/revelry/content/content.rb', line 9

def event
  'update'
end

#item_idObject



17
18
19
# File 'app/models/revelry/content/content.rb', line 17

def item_id
  model.id
end

#item_typeObject



13
14
15
# File 'app/models/revelry/content/content.rb', line 13

def item_type
  model.class.name
end

#reifyObject



21
22
23
# File 'app/models/revelry/content/content.rb', line 21

def reify
  model
end

#whodunnitObject



5
6
7
# File 'app/models/revelry/content/content.rb', line 5

def whodunnit
  model.last_whodunnit
end