Module: Ubiquitously::Restful::Post::InstanceMethods

Defined in:
lib/ubiquitously/models/service/post/restful.rb

Instance Method Summary collapse

Instance Method Details

#create_or_updateObject



38
39
40
# File 'lib/ubiquitously/models/service/post/restful.rb', line 38

def create_or_update
  new_record? ? create : update
end

#new_record?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/ubiquitously/models/service/post/restful.rb', line 46

def new_record?
  self.remote.blank?
end

#saveObject



34
35
36
# File 'lib/ubiquitously/models/service/post/restful.rb', line 34

def save
  create_or_update
end

#save!Object



42
43
44
# File 'lib/ubiquitously/models/service/post/restful.rb', line 42

def save!
  save || raise(Ubiquitously::RecordInvalid.new("Record is invalid: #{self.errors.full_messages}"))
end