Rails mongoid has field model validation
This can be done only with a custom method validation, Such as
class Comment
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Timestamps
include ActiveModel::Validations
validate :must_be_friends
def must_be_friends
errors.add(:base, 'Must be friends to leave a comment') if hash[:firstname].nil?
end
end
kayseriescortu.com - alacam.org - xescortun.com
ReplyDelete