[Rails] Re: ActiveRecord :dependent fails for me
> > Hi. I'm instantiating the movie via a finder, such as @movie =
> > Movie.find(params[:id])
> > and then calling @move.delete. I've seen this issue with my running
> > web application as well as any attempt using the rails console.
>
> > I haven't tried @movie.destroy because I don't have a before or after
> > destroy callback defined.
>
> Actually you do - it's how :dependentis implemented. 99.9% of the
> time you want to call destroy on AR objects, not delete.
>
> --Matt Jones
Hi, Matt, I've confirmed your point that I must call AR#delete in
order for the :dependent behavior to work. Thank you for the
clarification and solution. It's much appreciated!
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home