Todd Benson wrote:
> On Sat, Oct 25, 2008 at 11:51 AM, spox <[EMAIL PROTECTED]> wrote:
>> You can force the Model to do this by using before_destroy. So you would
>> end up with something like:
>>
>> class Edition < Sequel::Model(:cards_sets)
>>
>>    before_destroy :remove_card
>>
>>    def remove_card
>>        Card.filter(:id => card_id).destroy
>>    end
>>
>> end
> 
> To the OP... Just keep in mind that pulling data integrity out of the
> data layer and into the app layer may cause you problems in the future
> (you may not be able to use a different connector/language for the
> same DB with the same results, for example).
> 
> Todd
> 
> > 
This will work no matter what adapter is used. Granted, if things are
done manually, the integrity will be compromised, however, the relations
should be specified during table creation. As we see with sqlite, it
will not fail when the syntax for relations is given, but does nothing
for enforcement. Using the before_destroy will do the same thing in both
sqlite and postgres, for example, but postges will keep the integrity if
changes are made manually. The only issue you will face when using other
adapters is that the before_destroy may not be needed and thus you will
add extra actions for those adapters, but no compatibility will be lost.

spox

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to