Class: Renalware::Accesses::Plan
Class Method Summary
collapse
Instance Method Summary
collapse
#first_or_create_by!, #save_by, #save_by!, #update_by
Class Method Details
.attributes_to_ignore_when_comparing ⇒ Object
25
26
27
|
# File 'app/models/renalware/accesses/plan.rb', line 25
def self.attributes_to_ignore_when_comparing
[:id, :created_at, :updated_at, :created_by_id, :updated_by_id]
end
|
.policy_class ⇒ Object
21
22
23
|
# File 'app/models/renalware/accesses/plan.rb', line 21
def self.policy_class
BasePolicy
end
|
Instance Method Details
#identical_to?(other) ⇒ Boolean
29
30
31
32
|
# File 'app/models/renalware/accesses/plan.rb', line 29
def identical_to?(other)
attrs_to_ignore = self.class.attributes_to_ignore_when_comparing.map(&:to_s)
attributes.except(*attrs_to_ignore) == other.attributes.except(*attrs_to_ignore)
end
|
#terminate_by(user) ⇒ Object
34
35
36
37
38
|
# File 'app/models/renalware/accesses/plan.rb', line 34
def terminate_by(user)
self.terminated_at = Time.zone.now
self.by = user
save!
end
|