search for: validates_existence_of

Displaying 2 results from an estimated 2 matches for "validates_existence_of".

2008 May 07
0
Rspec and validates_existence_of
Hi List I am using validates_existence_of in some of my Model classes. For instance I have the following class: class User < ActiveRecord::Base belongs_to :department validates_existence_of :department end If I create an instance of User in the console and set the department to be one that does not exist in the db, then a...
2009 Jul 04
9
prevent orphan records
If I have belongs_to :user Do I need to have validates_presence_of :user_id ? Does Rails validate the presence of :user_id automatically if I have belongs_to :user? In other words, does Rails prevent against creating orphan records that belong to non-existent users? Thanks. -- Posted via http://www.ruby-forum.com/.