Module: ResourcesController::ActiveRecord::Saved

Defined in:
lib/resources_controller/active_record/saved.rb

Instance Method Summary collapse

Instance Method Details

#saved?Boolean

returns true if this record is not new, and has no errors

Returns:

  • (Boolean)


5
6
7
# File 'lib/resources_controller/active_record/saved.rb', line 5

def saved?
  !new_record? && (@errors.nil? || errors.empty?)
end

#validation_attempted?Boolean

returns true if this instance has had validation (maybe via save) attempted

Returns:

  • (Boolean)


10
11
12
# File 'lib/resources_controller/active_record/saved.rb', line 10

def validation_attempted?
  !@errors.nil?
end