Module: Dropzone::ValidateProfile
- Included in:
- BuyerProfile::Validator, SellerProfile::Validator
- Defined in:
- lib/dropzone/profile.rb
Class Method Summary collapse
Instance Method Summary collapse
- #must_have_declaration(profile) ⇒ Object
- #prior_profile_is_valid(profile) ⇒ Object
- #prior_profile_transferred_to_us(profile) ⇒ Object
Class Method Details
.included(base) ⇒ Object
45 46 47 48 49 |
# File 'lib/dropzone/profile.rb', line 45 def self.included(base) base.validate :must_have_declaration base.validate :prior_profile_is_valid base.validate :prior_profile_transferred_to_us end |
Instance Method Details
#must_have_declaration(profile) ⇒ Object
51 52 53 |
# File 'lib/dropzone/profile.rb', line 51 def must_have_declaration(profile) errors.add :addr, "profile not found" unless profile..length > 0 end |
#prior_profile_is_valid(profile) ⇒ Object
55 56 57 58 59 |
# File 'lib/dropzone/profile.rb', line 55 def prior_profile_is_valid(profile) if profile.prior_profile && !profile.prior_profile.valid? errors.add :prior_profile, "invalid" end end |
#prior_profile_transferred_to_us(profile) ⇒ Object
61 62 63 64 65 |
# File 'lib/dropzone/profile.rb', line 61 def prior_profile_transferred_to_us(profile) if profile.prior_profile && profile.prior_profile.transfer_pkey != profile.addr errors.add :prior_profile, "invalid transfer or closed" end end |