On 10-10-21 06:31 AM, Rajinder Yadav wrote:
On 10-10-20 08:46 PM, pepe wrote:
Use foreign key constraints in the database for this. The Foreigner gem
will help manage these constraints.

Yes, I think you're right and going with Referential Integrity should
be the way to go to make sure the rules are enforced at the DB level.
Although, I still would like to know how I can accomplish what I was
trying to do.

I didn't know about Foreigner and took a look. It seems that it is
meant to be used only with MySQL and PostgreSQL. I am using MSSQL and
have not found anything useful out there as gems/plugins go for this
DB. Any ideas?


you can run a sql command in your migration to generate a foreign key
constraint yourself, look at activerecord execute

this should give you an idea:

http://fdietz.wordpress.com/2008/08/03/migrations-and-foreign-key-handling/

--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

--
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