Sha256: 124012d8ff36dc7adca3592f60f79b4f607f3fe6802429b926157b9f62d46a26

Contents?: true

Size: 424 Bytes

Versions: 4

Compression:

Stored size: 424 Bytes

Contents

class CallbackForm < TransForms::FormBase
  attr_reader :user1, :user2, :i_was_called

  attribute :name1,      String
  attribute :name2,      String

  validates :name1, presence: true
  validates :name2, presence: true

  after_save_on_error :call_me

  transaction do
    @user1 = User.create!(name: name1)
    @user2 = User.create!(name: name2)
  end

protected
  def call_me(error)
    @i_was_called = true
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trans_forms-0.2.2 spec/support/trans_forms/callback_forms.rb
trans_forms-0.2.1 spec/support/trans_forms/callback_forms.rb
trans_forms-0.2.0 spec/support/trans_forms/callback_forms.rb
trans_forms-0.1.0 spec/support/trans_forms/callback_forms.rb