I have a table students with field ward_id and I have to create a table named guardian_users with fields id,ward_id,email,guardian_id,hashed_password etc.
Now I have to add constraint foreign key. Any update/delete/edit/insertion in students should have same effect on guardian_users.
How can I do that in rails 2.3.5?
Table students exists but other one doesn’t exist yet.
You’ll either need the foreign_key_migrations plugin or the
#executemethod. Assuming you go with the plugin:And in your models: