Home > validates-belongs-to

validates-belongs-to

Validates-belongs-to is a project mainly written in Ruby, it's free.

Rails 3 validation

Rails 3 validation to ensure that two ActiveModel associations are related to each other.

class JobApplication
  belongs_to :resume
  belongs_to :user
  validates :resume, :belongs_to => :user
end

The validation checks that job_application.resume.user is the same as job_application.user.

Installation:

gem 'validates-belongs-to'
Previous:triptox