not sure about that but you could ditch the dependent destroy and just
do a before_destroy call to remove the second class.

On Jun 6, 5:36 pm, oillio <[email protected]> wrote:
> I have two models A and B.
> They are connected as follow (relevant bits only):
> class A
>   has_many :bs, :dependent => :destroy
>
>   def destroy_permitted?
>     true
>   end
> end
>
> class B
>   def destroy_permitted?
>     false
>   end
> end
>
> As you can see, I do not want the user to be able to delete B.
> However, I do want the user to be able to delete A.  And if A is
> deleted, I do want all of it's B's to be deleted as well.
> Is it possible to express this desire?
>
> The code above thows a Hobo::PermissionDeniedError, which is to be
> expected.
> But is there a way to detect that a cascading delete is being
> performed within B's destroy_permitted? and allow it to happen?

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to