Module: DaisybillApi::Ext::CRUD::Update::InstanceMethods

Defined in:
lib/daisybill_api/ext/crud/update.rb

Instance Method Summary collapse

Instance Method Details

#saveObject

Updating a record

pt = DaisybillApi::Models::Patient.find(12) # => <DaisybillApi::Models::Patient id: 12...>

pt.telephone                # => "2138888888"

pt.telephone = "2137777777" # => "2137777777"

pt.telephone                # => "2137777777"

pt.save # => true


21
22
23
24
25
26
27
# File 'lib/daisybill_api/ext/crud/update.rb', line 21

def save
  return update unless new_record?
  return create if respond_to? :create
  message = "#save method is not supported for new record"
  DaisybillApi.logger.error message
  raise NotImplementedError.new message
end

#updateObject



30
31
32
# File 'lib/daisybill_api/ext/crud/update.rb', line 30

def update
  send_data :patch, show_path
end