Exception: Cardiac::RecordInvalid

Inherits:
ResourceError show all
Defined in:
lib/cardiac/errors.rb

Overview

See Also:

  • ActiveRecord::RecordInvalid

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ RecordInvalid

:nodoc:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cardiac/errors.rb', line 34

def initialize(record) # :nodoc:
  @record = record
  
  errors = @record.errors.full_messages.join(", ")
  remote_errors = @record.remote_errors.full_messages.join(", ")
  
  if remote_errors.present?
    remote_errors = "(previous remote operation) #{remote_errors}"
    errors += ' ' if errors.present?
  end
  
  super I18n.t(:"#{@record.class.i18n_scope}.errors.messages.record_invalid",
               errors:        errors,
               remote_errors: remote_errors,
               default:       :"errors.messages.record_invalid")
end

Instance Attribute Details

#recordObject (readonly)

:nodoc:



33
34
35
# File 'lib/cardiac/errors.rb', line 33

def record
  @record
end