Ruby Rail First Step: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
No edit summary
No edit summary
Line 16: Line 16:


# Visite the web site
# Visite the web site
[http://localhost:3000]
[http://localhost:3000 http://localhost:3000]


# change the default page  
# change the default page  

Revision as of 22:59, 14 November 2014

  • Your first application with MySQL
rails new firstapp -d mysql
  1. Move into the application directory
cd firstapp
  1. If you setup MySQL or Postgres with a username/password, modify the
  2. config/database.yml file to contain the username/password that you specified
  1. Create the database
rake db:create
  1. Start the server
rails server
  1. Visite the web site

http://localhost:3000

  1. change the default page

Add the following into config/routes.rb

root :to => "home#index"
  1. Generate a ressource
rails generate scaffold Post name:string title:string content:text

Creating and Customizing Rails Generators & Templates

  • Create Tables
rake db:migrate