On Apr 18, 2012, at 4:23 AM, Kal wrote:
Thanks Much Aash,
But as someone already replied:
“It only creates tables, but how to transfer data from these tables?
And I think It is same that rake db:migrate RAILS_ENV=production”
I’ve gotten as far as “rake db:migrate RAILS_ENV=production” from my
research thus far…
The whole idea behind separate databases and separate /data/ is that you
want your development environment to run quickly and lightly (on your
local computer) and you may want to entirely drop the database at some
point to try out a different approach. Then you migrate the changes made
during development to the production server (a separate physical machine
or cloud appliance).
The database on your production server should have nothing to do with
the database you hack on in development. (It is good practice to use the
same type of database in both places, but even that is not entirely
required. I have often made simple sites with squilte3 in development
and MySQL in production.) Any production content should only be entered
into the production server’s database.
If you make changes to the dev server, you do so using migrations, and
when you next synch the server with your latest changes, you shell into
the server and run
RAILS_ENV=production bundle exec rake db:migrate
to /alter/ the database with existing data intact.
Seriously, there’s no official document for a “Standard” way of doing
The standard way of doing this is to have development and test run on
the development computer (usually a Mac or *nix desktop or laptop) and
to have production run on a real server somewhere (usually Apache/Nginx
- Passenger on a *nix server). More elaborate or server-coupled sites
may have a staging or test environment on a duplicate *nix server, but
that depends a lot on your application.
I recommend that you read through the entire Rails Tutorial by Michael
Hartl. It’s free to read online, and there’s a paid version with
screencasts that’s also very nice. This will walk you through the
standard way of working in Rails, starting with tests and development on
your local computer, culminating with hosting the site on Heroku. Really
start at the beginning and work your way all the way to the end. I think
you’re missing a few steps here in your understanding.