4 ms·
When a migration runs, the schema.rb file is regenerated. This way, each checkin contains a complete snapshot of the schema that goes with that code. (side not
by snprbob86 15y ago
When a migration runs, the schema.rb file is regenerated. This way, each checkin contains a complete snapshot of the schema that goes with that code.
(side note: I think that schema.sql should be the default, not schema.rb)
- moe 15y agoYes, that's what everybody refers to when they quickly need to look up a field. However, having to look in two places to understand your model is a bit cumbersome, isn't it? Especially when complex associations come into play and you have to resolve the rails identifier magic in your head... And then there's the question of why you should have to refer to a cached copy of your schema when you could just spell it all out in one place.
- jarin 15y agoIf remembering attribute names is your concern, you can use an IDE or vim plugin for autocomplete, or just use annotated_models to add/update the schema down at the bottom of your model files on every db:migrate: https://github.com/openteam/annotated_models https://github.com/openteam/annotated_models
- moe 15y agoYou're proposing kludges for a problem that doesn't exist in declarative ORMs and that is far from the most serious issue of AR. My general point is that AR makes no sense for web applications.