Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:4780225
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
class Lawyer < ActiveRecord::Base
 
def extracted?
!source.blank?
end
 
with_options :unless => :extracted? do |lawyer|
lawyer.validates_presence_of :oab,
:phones,
:address,
:day_of_birth,
:email
lawyer.validates_associated :phones,
:address,
:nextels,
:cities
end
 
end
 
l = Lawyer.new
l.source = "whatever"
l.valid? # returns true
l.address = Address.new
l.valid? # returns false
l.save validate:false
l.reload
l.valid? # returns true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.