Rails 4 ActiveRecord Exclusion Validation for Association -
i'm trying validate association in model , exclude object validation, can't seem work. here's code:
validates :user, presence: true, exclusion: { in: [:lot_high_bidder] }
i imagine it's trying direct comparison of :user
symbol :lot_high_bidder
fail, mean can't use method name in exclusion validator or syntax wrong?
rails has validates_associated method used validate association on models
http://apidock.com/rails/activerecord/validations/classmethods/validates_associated
not sure if can validate user_id instead of user association.
hope helps
Comments
Post a Comment