Robert Walker wrote: > I'd say use the the before_destroy callback to validate the deletion: > > def before_destroy > !project_name.eql?("No project") > end
On second thought this might be a better approach: class Project < ActiveRecord::Base before_destroy :protect_no_project private def protect_no_project !name.eql?("No project") end end It sounds like overriding the callback directly may not be the best approach. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---