1

I have pretty big RoR app. There is superclass named User.

class User < ActiveRecord::Base
  validates :email, presence: true
end

Also I have class Client which inherited by User

class Client < User
with_options(on: [:personal_info]) do |pi|
  pi.validates :first_name,
               :last_name,
               :email,
               :mobile_phone,
               :landline_phone,
               presence: true
  pi.validates :primary_email,
               email_format: {
                 message: "doesn't look like an email address"
               }
end
end

When I create Client's object I got 2 errors that "Email can't be blank." How can I disable or skip validates of superclass?? Remove validations in superclass is impossible.

Andrey Deineko
  • 51,333
  • 10
  • 112
  • 145
mxgoncharov
  • 475
  • 2
  • 7
  • 15

0 Answers0