Try
belongs_to :banner, :dependent => true
This says that the child row cannot exist without the row in the parent
table, and will do a cascading delete.
Ken
zven wrote:> Hi. Please help me how to make cascade delete for this 3 classes:
>
> class Section < ActiveRecord:Base
> has_many :ad_bindings
> has_many: banners, :through => :ad_bindings
> end
>
> class AdBinding < ActiveRecord:Base
> belongs_to :banner
> end
>
> class Banner < ActiveRecord:Base
>
> end
>
> When I remove Banner, I need to remove AdBinding also, but it still
> stored in database. Where I wrong?
>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>