before_save
is called and video_id
is populated after validations are ran. In this case, you are validating the uniqueness of nil, which will pass if :allow_nil => true
.
Use the before_validate
callback to populate video_id
before validating.