Gentle Core Folk:I'm started trying to work with edge Rails, documenting how you'd create a Depot application with them. I'm probably missing something here, but as far as I can see, the new generator that creates the migration whenever your create a scaffold or model is not particularly useful (and in fact is actually counter productive).
Let's take the scaffolding case. If I run script/generate scaffold product adminI expect it to generate a _form that lets me edit the fields in an _existing_ product table. However, by default, the generator also creates a db/migration/xxx_add_products.rb migration. This scaffold contains up and down methods with create and drop table method calls. But... for me to be using static scaffolds, I _already have_ a products table. This migration code will actually fail when I type 'rake migrate' , leaving me in an inconsistent state.
So... maybe the idea is to create the scaffold prior to creating the table, then add the table definition to the migration, and run rake migrate. But, no, that doesn't work either, as the scaffold generator blows up if the table isn't there. (In fact, it's worse than that, as it also leaves the empty migration file lying around before it exits, so I can't add the table and rerun the generator--I have to run destroy first).
So, all things considered, I'd like to suggest that we probably want to lose this feature--I just don't see how it fits into any reasonable workflow. It seems to me the workflow is
- create the table with a migration then, either - create the model and controller and start hacking, or - create the scaffold then - add migrations, alter the models and controllers - repeat until IPONow, I know you can skip scaffold generation in the generators. But surely this should be the default, and the current condition just doesn't seem to be useful in practice.
(On a tangential note, if the model and scaffold generators _do_ have to create migrations, they should really be called 'create_tablename', not 'add_tablename', just to be consistent.)
Dave (who's just trying to keep up).
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
