Are you talking about a polymorphic association??

You can set that up simply enough in the models after doing a wee
search on them,

http://envycasts.com/products/advanced-activerecord

May have some interesting insight into them, it would then be easy
enough to create a method from a before_destroy callback to check if
it is being used or not...

Cheers

Richard

On Mar 18, 8:05 pm, ms <[email protected]> wrote:
> Hey,
>
> thanks for reading this post. How do you handle dependencies? A really
> simple example: I've got a table called "entity" and another table,
> let's say, "entity_type". The entity types can be changed, of course,
> they also should be deletable, but only, if they are not used by some
> entities! How can I ensure this in Rails or directly in the DBMS
> (postgres)? Do I have to check it manually within a validate-method in
> the model?
>
> Thanks for any suggestions!
>
> Cheers, ms
--~--~---------~--~----~------------~-------~--~----~
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