Class: Peoplefinder::Version

Inherits:
PaperTrail::Version
  • Object
show all
Defined in:
app/models/peoplefinder/version.rb

Instance Method Summary collapse

Instance Method Details

#alteration?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/peoplefinder/version.rb', line 14

def alteration?
  event == 'update'
end

#creation?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'app/models/peoplefinder/version.rb', line 6

def creation?
  event == 'create'
end

#destruction?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/peoplefinder/version.rb', line 10

def destruction?
  event == 'destroy'
end

#event_descriptionObject



27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/peoplefinder/version.rb', line 27

def event_description
  if creation?
    "New #{ item_type }"

  elsif destruction?
    "Deleted #{ item_type }"

  elsif alteration?
    "#{ item_type } Edited"
  end
end

#membership?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/peoplefinder/version.rb', line 18

def membership?
  item_type == 'Peoplefinder::Membership'
end

#undoObject



22
23
24
25
# File 'app/models/peoplefinder/version.rb', line 22

def undo
  return if membership?
  creation? ? item.destroy : reify.save
end