bogdans83 / validates_existence_of

A small plugin to validate the existence of an AR record

This URL has Read+Write access

name age message
file MIT-LICENSE Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
file README.rdoc Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
file Rakefile Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
file init.rb Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
file install.rb Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
directory lib/ Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
directory tasks/ Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
directory test/ Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
file uninstall.rb Fri Jun 06 04:05:54 -0700 2008 Plugin without tests [bogdans83]
README.rdoc

Validates Existance Of Plugin

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.

Usage

  validates_existance_of :belongs_to_association

Example

  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

Instalation

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

or use "braid": evil.che.lu/projects/braid

Uninteresting stuff

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