I find it more 'unconventional' that you use fk's than that you load UserType with the old User. Admin, which I guess happens pretty often.
I find it more 'unconventional' that you use fk's than that you load UserType with the old User. Admin, which I guess happens pretty often. If you use fk's you get ugly mysql errors that confuse the user.
If otherwise you use AR validations and hooks to enforce the referential integrity you get pretty and well integrted error messages that do not break the user experience flow of your app. Don't worry for a migration that will run once and think about the business logic that you're putting outside your code. This is all matter of opinion/convention, but I hope you find my insights someway helpful.
When it comes to foreign keys, I've find them to be quite helpful, especially when dealing with buisness critical data. It helps me avoid dangling data, and to detect whether I've missed applying hooks and the like from Rails' side. Although you are right they might give you some ugly error messages.
– Daniel Abrahamsson May 22 '10 at 7:52 1 I see, it's a matter of choice. If data integrity beyond backups is over UX, fk are the way to go. In that case you have a plugin for managing fk's from your migrations: agilewebdevelopment.Com/plugins/foreign_key_migrations – Fer May 22 '10 at 12:51 Ok.
Thank you for the tip! – Daniel Abrahamsson May 24 '10 at 6:23.
The file db/seeds. Rb is commonly used for this purpose - records placed in there will be loaded as part of rake db:setup However, I've always found rails falls down on this problem. I've been thinking of writing a plugin that gives you a db/seeds folder, has datestamped seedfiles for adding records (.yml, perhaps) and tracks the seed data in a system table so it can be reverted / updated.
As you can see in the code, I can not use seeds as I would like to apply several migrations at once, and the last migration depends on that there is data in the database. It would be nice if you could have one seed file per migration, and that the seed files would be applied in between migrations. So first 20100524...do_something.
Rb is run and then 20100524...seed_something. Rb performs the required seeding for this migration. – Daniel Abrahamsson May 24 '10 at 6:26.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.