search for: before_delet

Displaying 3 results from an estimated 3 matches for "before_delet".

Did you mean: before_delete
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 ||
2006 Jun 23
10
Don''t un-admin the last administrator
...d when editing a user as you can revoke a user''s administrator privileges via a form. User belongs_to :account. Account has_many :Users I was thinking that the best way to do this would involve either before_update and before_destroy or a validation. I think I know how to write the before_delete as that just involves knowing which user you are going to delete and checking if its account has more than one administrator. I am unsure how to write before_update as that requires not only knowing which user you are going to update but also if the updated info would make that user no longer...
2006 Mar 05
2
How to clean up this code?
...s_'' + id + ''_image_url" name="images['' + id + ''][image_url]" size="30" /><br />''; new Insertion.Before("add_image", image_field); } ------------------------------------------------- I''ve also added before_delete method to image model to delete the file when the record is deleted from the database. I didn''t present here ''update'' action for the product controller, because i don''t know how to create names for new pictures. The method with input field number doesn'&...