I’m trying to get started with Rails, but I’m running into a few places
where I’m having trouble understanding the expected workflow.
I’m trying to work with migrations from the beginner; its a port of an
existing application, but I’d like to let the db schema evolve as the
application grows, so I’m starting from an empty (tableless) database.
If I generate a migration, I can fill in the up/down methods and start
creating a table; rake migrate ran fan. However when I then generate a
model it seems to create another migration automatically that is named
appropriately for the eariler self-created migration. This seemed odd,
so I thought I did something against the expected way. As I hadn’t done
anything, I wiped the DB and the rails project and recreated both. This
time I tried generating a scaffolding first, thinking that it would
create the first migration that I would then fill in and get things
rolling from there. This generated the “before updating scaffolding
from a new DB schema…” error. (Which makes sense to me now that I
think about it.)
Can anyone help me out and explain what the “expected” order of
“generate foos” are when starting from a completely blank slate if I
want to do things the “rails”-way? (I would prefer to use migrations as
opposed to creating the ddl manually, as long as that preference isn’t
at odds with normal rails practices)
Also, am I correct that the only way to “back-out” a script/generate foo
is to rollback via version control?
Thank you.