Rails 3 validation
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
Gemfile
README.md
Rakefile
validates-belongs-to.gemspec

README.md

Build Status

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'