Sha256: c1b11286238c2db2a62eee06923b6d9cba3a66ab760314056270f5844c8bb130

Contents?: true

Size: 431 Bytes

Versions: 65

Compression:

Stored size: 431 Bytes

Contents

class Agilibox::MiniFormObject < SimpleDelegator
  include ActiveModel::Validations
  extend Forwardable

  def valid?
    __getobj__.valid?
    run_validations!
  end

  def invalid?
    !valid?
  end

  alias validate valid?

  def validate!
    valid? || raise_validation_error
  end

  def_delegators :__getobj__, :errors

  def save
    valid? && __getobj__.save
  end

  def save!
    validate! && __getobj__.save!
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
agilibox-1.3.0 app/forms/agilibox/mini_form_object.rb
agilibox-1.2.3 app/forms/agilibox/mini_form_object.rb
agilibox-1.2.2 app/forms/agilibox/mini_form_object.rb
agilibox-1.2.1 app/forms/agilibox/mini_form_object.rb
agilibox-1.2.0 app/forms/agilibox/mini_form_object.rb