Displaying 1 result from an estimated 1 matches for "name_of_field_with_error".
2005 Oct 23
12
Showing a neat error message
Hi All,
I''m trying to prevent users from deleting a folder that has contents
like this:
class Folder < ActiveRecord::Base
has_many :myfiles
has_many :folders
belongs_to :folder
validates_uniqueness_of :name, :scope => "folder_id"
before_destroy :dont_destroy_folder_with_contents
def dont_destroy_folder_with_contents
if Folder.find(id) != nil ||