Class: Changes::Delete

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic_fields/changes/delete.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_name, record) ⇒ Delete

Returns a new instance of Delete.



5
6
7
8
# File 'lib/dynamic_fields/changes/delete.rb', line 5

def initialize(field_name, record)
  @field_name, @record = field_name, record
  @value = nil
end

Instance Attribute Details

#field_nameObject (readonly)

Returns the value of attribute field_name.



3
4
5
# File 'lib/dynamic_fields/changes/delete.rb', line 3

def field_name
  @field_name
end

#recordObject (readonly)

Returns the value of attribute record.



3
4
5
# File 'lib/dynamic_fields/changes/delete.rb', line 3

def record
  @record
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/dynamic_fields/changes/delete.rb', line 3

def value
  @value
end

Instance Method Details

#saveObject



10
11
12
# File 'lib/dynamic_fields/changes/delete.rb', line 10

def save
  record.public_send("#{field_name}_attribute=", nil)
end