Skip to content

Instantly share code, notes, and snippets.

@reneedv
Created June 1, 2012 03:32
Show Gist options
  • Save reneedv/2848484 to your computer and use it in GitHub Desktop.
Save reneedv/2848484 to your computer and use it in GitHub Desktop.
Making and Deploying a new Rails web application using Postgresql
#1 First open your terminal program and type cd to go to your home directory:
cd
#2 To create a new rails application called q_man using postgresql:
rails new q_man -d postgresql
#3 Enter the application directory:
cd q_man
#4 Start the local webserver
rails s
#5 open your web browser and go to this address:
http://localhost:3000
#6 Stop your local server by holding the control key and pressing c
## or you can leave it running, open a new terminal window, and cd to the q_man directory
control-c
#7 Initialize a local git repository
git init
#7.5 View your git status
git status
#8 Add all the files in your q_man directory
git add .
#9 Commit those files to the repository with a nice message
## you can change the message to whatever you like
git commit -m "adding blank rails app to local repo"
#10 Install the heroku gem if you don't have it already
gem install heroku
#11 Setup your new rails app to deploy to Heroku
## this step may ask you for your Heroku login and password
### (if you get a message about an ssh-key please let us know)
## we have to specify to use the Cedar stack, which tells Heroku we are using Rails version 3
heroku create --stack cedar
#12 Deploy your new application to Heroku
git push heroku master
#13 Open the app you deployed to Heroku in your web browser
heroku open
#14 Open the q_man directory in Sublime
open->q_man
#15 Find the index.html file
q_man->public->index.html
#16 Modify the Welcome message, or some other part of the index page text
#17 Re-start your local webserver if you stopped it before with this command:
rails s
#18 View your changes in your web browser
http://localhost:3000
#18.5 Stop your server or go to the tab that is not running your webserver
control-c
#19 View what you have changed
git status
#20 Add your changes
git add .
#21 Commit your changes (you should have a nicer message than "message")
git commit -m "message"
#22 Deploy your changes to Heroku
git push heroku master
#23 View your changes on Heroku
heroku open
#24 Modify your database configuration file with your postgresql username and password
## change the username and password fields in the development and test sections
q_man->config->database.yml
#25 Apply your database configuration changes from your q_man directory at the command line
rake db:create
rake db:migrate
#26 Add and commit your database changes to your repository
git add .
git commit -m "message"
#27 Deploy your changes to Heroku
git push heroku master
heroku open
@jrod01
Copy link

jrod01 commented Jun 5, 2012

rails generate scaffold RESOURCE_NAME ATT1:TYPE ATT2:TYPE ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment