Module: Decanter::Extensions
- Defined in:
- lib/decanter/extensions.rb
Defined Under Namespace
Modules: ActiveRecordExtensions, ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
3
4
5
|
# File 'lib/decanter/extensions.rb', line 3
def self.included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#decant(args, **options) ⇒ Object
17
18
19
|
# File 'lib/decanter/extensions.rb', line 17
def decant(args, **options)
self.class.decant(args, options)
end
|
#decant_update(args, **options) ⇒ Object
7
8
9
10
|
# File 'lib/decanter/extensions.rb', line 7
def decant_update(args, **options)
self.attributes = self.class.decant(args, options)
self.save(context: options[:context])
end
|
#decant_update!(args, **options) ⇒ Object
12
13
14
15
|
# File 'lib/decanter/extensions.rb', line 12
def decant_update!(args, **options)
self.attributes = self.class.decant(args, options)
self.save!(context: options[:context])
end
|