Andrew Timberlake wrote:
> Set the model readonly
> 
> class MyModel < ActiveRecord::Base
>   def initialize(*args)
>     super(*args)
>     readonly!
>   end
> end
Wouldn't this make all records of the table read only? I don't think 
that's what the OP wanted.

I'd say use the the before_destroy callback to validate the deletion:

def before_destroy
  !project_name.eql?("No project")
end
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to