before_destroy call back function is a good option... On Tue, Sep 7, 2010 at 10:31 PM, Ken Hudson <[email protected] > wrote:
> Hi All, > > According to the Rails documentation, has_many associations have a > :dependent option that can be set to :restrict. "If set to :restrict this > object cannot be deleted if it has any associated object". This is what I > wanted so I have the following code in my gallery model: > > has_many :images, :dependent => :restrict > > However, I am getting the following error: > > "ArgumentError: The :dependent option expects either :destroy, :delete_all, > or :nullify (:restrict)" > > Any idea what my problem is? I'm not sure why :restrict is shown in > parentheses in the error message. The documentation clearly shows it as a > valid option for :dependent... > > Thanks, Ken > > > > > > > > > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby -- Anurag Pattnaik Mobile: +91-94371-78396 -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
