Sha256: bfcb24578477466d38c6281272055d933f2d52fca4075cbc79ad082092e90fa2

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

class NoErrorInTransactionForm < TransForms::FormBase
  transaction do
    # Bunch of actions
    1 + 1; 'No errors'; [1,2,3].map(&:to_s)
    false # Can return false, save will be success anyway
  end
end

class ErrorInTransactionForm < TransForms::FormBase
  transaction do
    raise ActiveRecord::ActiveRecordError
  end
end

class RecordNotFoundInTransactionForm < TransForms::FormBase
  transaction do
    User.find 9999999
  end
end

class RecordNotSavedInTransactionForm < TransForms::FormBase
  transaction do
    user = User.new
    raise ActiveRecord::RecordNotSaved, ['Could not save the record', user]
  end
end

class RecordInvalidInTransactionForm < TransForms::FormBase
  transaction do
    User.new.save!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trans_forms-0.2.2 spec/support/trans_forms/simple_forms.rb