Socket
Book a DemoInstallSign in
Socket

shuber-validates_existence

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shuber-validates_existence

bundlerRubygems
Version
1.0.0
Version published
Maintainers
1
Created
Source

ValidatesExistence

This plugin adds a new validates_existence_of method to ActiveRecord::Base.

The validates_existence_of validator checks that a foreign key in a belongs_to association points to an existing record. If :allow_nil => true, then the key itself may be nil. A non-nil key requires that the foreign object must exist. Works with polymorphic belongs_to.

The default error message is "does not exist".

Example

class Person < ActiveRecord::Base
  belongs_to :address
  validates_existence_of :address
end

Note that this validation performs a query to see if the record in question exists.

Copyright (c) 2007-2008 Josh Susser. Released under the MIT license.

FAQs

Package last updated on 10 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts