Module: SfCli::Sf::Model::DmlMethods
- Defined in:
- lib/sf_cli/sf/model/dml_methods.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(c) ⇒ Object
6 7 8 |
# File 'lib/sf_cli/sf/model/dml_methods.rb', line 6 def self.included(c) c.extend ClassMethods end |
Instance Method Details
#delete ⇒ Object
23 24 25 26 27 |
# File 'lib/sf_cli/sf/model/dml_methods.rb', line 23 def delete return if self.Id.nil? self.class.connection.delete(self.class.name.to_sym, self.Id) end |
#save ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sf_cli/sf/model/dml_methods.rb', line 10 def save if new_record? self.Id = self.class.connection.create(self.class.name.to_sym, current_attributes.reject{|_,v| v.nil?}) else self.class.connection.update(self.class.name.to_sym, self.Id, updated_attributes.reject{|_,v| v.nil?}) end @original_attributes = current_attributes.dup @updated_attributes = {} self.Id end |