Sha256: 4bee8a223c7bf6d9045403ee800a40bbe124f59b07b16511a0a39767dfcb30df

Contents?: true

Size: 285 Bytes

Versions: 4

Compression:

Stored size: 285 Bytes

Contents

class User < ActiveRecord::Base
  validation_accessor :address_attributes, :other_attributes

  validates :name, presence: true
  with_options if: :validate_on_address_attributes? do |user|
    user.validates :address, presence: true
    user.validates :city, presence: true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
conditional_validation-0.0.5 test/dummy/app/models/user.rb
conditional_validation-0.0.4 test/dummy/app/models/user.rb
conditional_validation-0.0.3 test/dummy/app/models/user.rb
conditional_validation-0.0.2 test/dummy/app/models/user.rb