Skip to content

A plugin to validate the existance of a rails association. Similar with validates_associated with the exception of not doing valid? on the association model

License

Notifications You must be signed in to change notification settings

ropiku/validatesexistanceof

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Validates the existance of an associated record in the database through a belongs_to association.

validates_existance_of :ar_belongs_to_association

Supports polymorphic associations.

validates_existance_of :belongs_to_association
class Country < ActiveRecord::Base

  has_many :users

end

class User < ActiveRecord::Base

  belongs_to :country

  validates_presence_of :country_id

  # Will pass if the associated country exists in the database
  validates_existance_of :country 

end
git clone git://github.com/bogdans83/validatesexistanceof.git

or use “braid”: evil.che.lu/projects/braid

Author:: Bogdan Sandulescu <bogdan at okapistudio the point com>
License:: Copyright 2008 Bogdan Sandulescu
          Released under an MIT-style license.

About

A plugin to validate the existance of a rails association. Similar with validates_associated with the exception of not doing valid? on the association model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%