Class: Renalware::HD::ReviseHDProfile
- Inherits:
-
Object
- Object
- Renalware::HD::ReviseHDProfile
- Defined in:
- app/models/renalware/hd/revise_hd_profile.rb
Instance Attribute Summary collapse
-
#new_profile ⇒ Object
readonly
Returns the value of attribute new_profile.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(profile) ⇒ ReviseHDProfile
constructor
A new instance of ReviseHDProfile.
Constructor Details
#initialize(profile) ⇒ ReviseHDProfile
Returns a new instance of ReviseHDProfile.
8 9 10 11 12 |
# File 'app/models/renalware/hd/revise_hd_profile.rb', line 8 def initialize(profile) raise(ArgumentError, "Cannot revise a new Profile") unless profile.persisted? @profile = profile end |
Instance Attribute Details
#new_profile ⇒ Object (readonly)
Returns the value of attribute new_profile.
6 7 8 |
# File 'app/models/renalware/hd/revise_hd_profile.rb', line 6 def new_profile @new_profile end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
6 7 8 |
# File 'app/models/renalware/hd/revise_hd_profile.rb', line 6 def profile @profile end |
Instance Method Details
#call(params) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/models/renalware/hd/revise_hd_profile.rb', line 14 def call(params) profile.assign_attributes(params) return true unless profile.changed? return false unless profile.valid? profile.restore_attributes @new_profile = profile.supersede!(params) end |