0
Web Development on Rails
Introducing James and Dana Gray,
this training, and Ruby on Rails
Teachers and Students
We’re going to spend three days working
together, so let’s get to know each other
Who am I?
Who am I?

My name: James Edward Gray II
Who am I?

My name: James Edward Gray II
My experience: I’ve been using Ruby since before
Rails was released and in the la...
Who am I?

My name: James Edward Gray II
My experience: I’ve been using Ruby since before
Rails was released and in the la...
Who is my partner?
Who is my partner?

Her name: Dana Gray
Who is my partner?

Her name: Dana Gray
What James thinks about her: She’s cute!
Who is my partner?

Her name: Dana Gray
What James thinks about her: She’s cute!
Her secret: She’s having a baby
Who is my partner?

Her name: Dana Gray
What James thinks about her: She’s cute!
Her secret: She’s having a baby
Ignore wh...
Your turn!
Your turn!

 Please tell us:
Your turn!

 Please tell us:
   Your name
Your turn!

 Please tell us:
   Your name
   What you know of Ruby/Rails and what you hope to
   learn in this training
Your turn!

 Please tell us:
   Your name
   What you know of Ruby/Rails and what you hope to
   learn in this training
  ...
This Training
What the heck are we doing here?
We Will Teach
Web Development
We Will Teach
Web Development
We are going to teach you how to build complete Web
applications using Rails
We Will Teach
Web Development
We are going to teach you how to build complete Web
applications using Rails
It’s a lot to c...
We Will Teach
Web Development
We are going to teach you how to build complete Web
applications using Rails
It’s a lot to c...
We Will Teach
Web Development
We are going to teach you how to build complete Web
applications using Rails
It’s a lot to c...
We Will Teach
Web Development
We are going to teach you how to build complete Web
applications using Rails
It’s a lot to c...
We Have Hands-on Labs
We Have Hands-on Labs
Theory is great, and we will teach that about half of the
time, but you learn Rails by building Rail...
We Have Hands-on Labs
Theory is great, and we will teach that about half of the
time, but you learn Rails by building Rail...
We Have Hands-on Labs
Theory is great, and we will teach that about half of the
time, but you learn Rails by building Rail...
We Have Hands-on Labs
Theory is great, and we will teach that about half of the
time, but you learn Rails by building Rail...
We Have Hands-on Labs
Theory is great, and we will teach that about half of the
time, but you learn Rails by building Rail...
We are Interactive
We are Interactive

 Wake up!
We are Interactive

 Wake up!
 We like questions
We are Interactive

 Wake up!
 We like questions
   Everyone benefits if we turn this into more of a
   discussion and less...
We are Interactive

 Wake up!
 We like questions
   Everyone benefits if we turn this into more of a
   discussion and less...
We are Interactive

 Wake up!
 We like questions
   Everyone benefits if we turn this into more of a
   discussion and less...
Ruby on Rails
What exactly is this “Rails” thing?
Software Moved Online
Software Moved Online
Ruby on Rails is a framework for building web
applications (interactive Web sites)
Software Moved Online
Ruby on Rails is a framework for building web
applications (interactive Web sites)
Web development h...
Software Moved Online
Ruby on Rails is a framework for building web
applications (interactive Web sites)
Web development h...
Software Moved Online
Ruby on Rails is a framework for building web
applications (interactive Web sites)
Web development h...
Software Moved Online
Ruby on Rails is a framework for building web
applications (interactive Web sites)
Web development h...
Rails is Ruby, right?
Rails is Ruby, right?
 Wrong!
Rails is Ruby, right?
 Wrong!
 Ruby is a programming
 language

                           The Ruby
                      ...
Rails is Ruby, right?
 Wrong!
 Ruby is a programming     The Ruby on Rails
 language                     Application
 Ruby...
Rails is Ruby, right?
 Wrong!
 Ruby is a programming     The Ruby on Rails
 language                     Application
 Ruby...
The Ruby
Programming Language
The Ruby
Programming Language
Created in Japan in 1995 by Yukihiro Matsumoto (“we
call him “matz”)
The Ruby
Programming Language
Created in Japan in 1995 by Yukihiro Matsumoto (“we
call him “matz”)
  It’s a few months old...
The Ruby
Programming Language
Created in Japan in 1995 by Yukihiro Matsumoto (“we
call him “matz”)
  It’s a few months old...
The Ruby
Programming Language
Created in Japan in 1995 by Yukihiro Matsumoto (“we
call him “matz”)
  It’s a few months old...
The Ruby on Rails
Application Framework
The Ruby on Rails
Application Framework
Created in 2003 by David Heinemeier Hansson (we call
him “DHH”)
The Ruby on Rails
Application Framework
Created in 2003 by David Heinemeier Hansson (we call
him “DHH”)
Rails was extracte...
The Ruby on Rails
Application Framework
Created in 2003 by David Heinemeier Hansson (we call
him “DHH”)
Rails was extracte...
The Ruby on Rails
Application Framework
Created in 2003 by David Heinemeier Hansson (we call
him “DHH”)
Rails was extracte...
Railsisms
Rails is very opinionated software!
The Rails Way
The Rails Way

Rails often has a preferred approach to a task and it
assumes you will be taking that approach
The Rails Way

Rails often has a preferred approach to a task and it
assumes you will be taking that approach
You can almo...
The Rails Way

Rails often has a preferred approach to a task and it
assumes you will be taking that approach
You can almo...
The Rails Way

Rails often has a preferred approach to a task and it
assumes you will be taking that approach
You can almo...
Convention Over
Configuration
Convention Over
Configuration
Rails has considerably less configuration files than
many other Web frameworks
Convention Over
Configuration
Rails has considerably less configuration files than
many other Web frameworks
Instead of alway...
Convention Over
Configuration
Rails has considerably less configuration files than
many other Web frameworks
Instead of alway...
Convention Over
Configuration
Rails has considerably less configuration files than
many other Web frameworks
Instead of alway...
MVC Architecture
MVC Architecture

Rails separates code:
MVC Architecture

Rails separates code:            Database
  Models (database–     Models
  business logic)
MVC Architecture

Rails separates code:             Database
  Models (database–     Models
  business logic)
  Views (Web...
MVC Architecture

Rails separates code:             Database
  Models (database–     Models
  business logic)
  Views (Web...
Rails Cares How You Code
Rails Cares How You Code
DRY
Rails Cares How You Code
DRY
 Don’t Repeat Yourself
Rails Cares How You Code
DRY
 Don’t Repeat Yourself
 Rails has tools to help you avoid repeating code
Rails Cares How You Code
DRY
 Don’t Repeat Yourself
 Rails has tools to help you avoid repeating code
YAGNI
Rails Cares How You Code
DRY
 Don’t Repeat Yourself
 Rails has tools to help you avoid repeating code
YAGNI
 You Ain’t Gon...
Rails Cares How You Code
DRY
 Don’t Repeat Yourself
 Rails has tools to help you avoid repeating code
YAGNI
 You Ain’t Gon...
Rails Cares How You Code
DRY
  Don’t Repeat Yourself
  Rails has tools to help you avoid repeating code
YAGNI
  You Ain’t ...
The Anatomy
of a Rails Project
Let’s take a first look at how Rails prefers to
keep its house
Starting a Rails Project
Starting a Rails Project
                             $ rails -d sqlite3 my_project
 Ask Rails to create             creat...
Starting a Rails Project
                             $ rails -d sqlite3 my_project
 Ask Rails to create             creat...
Starting a Rails Project
                             $ rails -d sqlite3 my_project
 Ask Rails to create             creat...
Starting a Rails Project
                             $ rails -d sqlite3 my_project
 Ask Rails to create             creat...
The app/ Directory
The app/ Directory

The heart of your
application
The app/ Directory

The heart of your
application
You can see the MVC
design in here
The app/ Directory

The heart of your
application
You can see the MVC
design in here
  Helpers relate to
  views
The lib/ and
vendor/ Directories
The lib/ and
vendor/ Directories
 lib/ is for library code
 shared by your entire
 application
The lib/ and
vendor/ Directories
 lib/ is for library code
 shared by your entire
 application
   It also holds
   mainten...
The lib/ and
vendor/ Directories
 lib/ is for library code
 shared by your entire
 application
   It also holds
   mainten...
The test/ Directory
The test/ Directory

 Rails encourages you
 to test your application
 on multiple levels
The test/ Directory

 Rails encourages you
 to test your application
 on multiple levels
 It also provides tools
 for load...
The public/ Directory
The public/ Directory
 For static assets:
The public/ Directory
 For static assets:
   Static HTML pages
The public/ Directory
 For static assets:
   Static HTML pages
   Error Pages
The public/ Directory
 For static assets:
   Static HTML pages
   Error Pages
   Images and CSS
The public/ Directory
 For static assets:
   Static HTML pages
   Error Pages
   Images and CSS
   JavaScript
   (Prototyp...
The config/ Directory
The config/ Directory

Where you can change
Rails configuration
The config/ Directory

Where you can change
Rails configuration
  It’s all set to
  conventions for you
The config/ Directory

Where you can change
Rails configuration
  It’s all set to
  conventions for you
Note that Rails can ...
config/database.yml
Rails configures a different database
for each environment
# SQLite version 3.x
     # gem install sqlite3-ruby (not necessary on OS X Leopard)
     development:
      adapter: sqli...
# SQLite version 3.x
     # gem install sqlite3-ruby (not necessary on OS X Leopard)
     development:
      adapter: sqli...
The log/ Directory
The log/ Directory

 Rails logs events from
 each of its
 environments
The log/ Directory

 Rails logs events from
 each of its
 environments
 This helps debug
 issues
The log/ Directory

 Rails logs events from
 each of its
 environments
 This helps debug
 issues
 It can also be used for
...
The Rakefile and
script/ Directory
The Rakefile and
script/ Directory
 Rails has scripts for:
The Rakefile and
script/ Directory
 Rails has scripts for:
   Creating new models
   and controllers
The Rakefile and
script/ Directory
 Rails has scripts for:
   Creating new models
   and controllers
   Interactively worki...
The Rakefile and
script/ Directory
 Rails has scripts for:
   Creating new models
   and controllers
   Interactively worki...
The Rakefile and
script/ Directory
 Rails has scripts for:
   Creating new models
   and controllers
   Interactively worki...
The Rakefile and
script/ Directory
 Rails has scripts for:
   Creating new models
   and controllers
   Interactively worki...
script/server
Launching your Rails application is as simple as
triggering the server script
$ cd my_project
   $ script/server
   => Booting Mongrel
   => Rails 2.3.5 application starting on http://0.0.0.0:3000
   ...
$ cd my_project
   $ script/server
   => Booting Mongrel
   => Rails 2.3.5 application starting on http://0.0.0.0:3000
   ...
Rails Up and Running
Browse to http://localhost:3000/
to see your application running
Questions?
Creating a
Rails Application Lab
Your book has instructions for getting started
with a Rails application: team up and try ...
Upcoming SlideShare
Loading in...5
×

Wed Development on Rails

1,316

Published on

This was the first speech of a three day Rails training I gave in Tulsa, OK in the spring 2010.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,316
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
52
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide












































































































































  • Transcript of "Wed Development on Rails"

    1. 1. Web Development on Rails Introducing James and Dana Gray, this training, and Ruby on Rails
    2. 2. Teachers and Students We’re going to spend three days working together, so let’s get to know each other
    3. 3. Who am I?
    4. 4. Who am I? My name: James Edward Gray II
    5. 5. Who am I? My name: James Edward Gray II My experience: I’ve been using Ruby since before Rails was released and in the last five years I’ve worked on over 30 shipping Rails applications
    6. 6. Who am I? My name: James Edward Gray II My experience: I’ve been using Ruby since before Rails was released and in the last five years I’ve worked on over 30 shipping Rails applications The One True Dessert Food: Angel food cake
    7. 7. Who is my partner?
    8. 8. Who is my partner? Her name: Dana Gray
    9. 9. Who is my partner? Her name: Dana Gray What James thinks about her: She’s cute!
    10. 10. Who is my partner? Her name: Dana Gray What James thinks about her: She’s cute! Her secret: She’s having a baby
    11. 11. Who is my partner? Her name: Dana Gray What James thinks about her: She’s cute! Her secret: She’s having a baby Ignore what she says about dessert because we already learned it is: Angel food cake
    12. 12. Your turn!
    13. 13. Your turn! Please tell us:
    14. 14. Your turn! Please tell us: Your name
    15. 15. Your turn! Please tell us: Your name What you know of Ruby/Rails and what you hope to learn in this training
    16. 16. Your turn! Please tell us: Your name What you know of Ruby/Rails and what you hope to learn in this training A fun fact (doesn’t have to be your favorite dessert)
    17. 17. This Training What the heck are we doing here?
    18. 18. We Will Teach Web Development
    19. 19. We Will Teach Web Development We are going to teach you how to build complete Web applications using Rails
    20. 20. We Will Teach Web Development We are going to teach you how to build complete Web applications using Rails It’s a lot to cover and we don’t have time to do it all
    21. 21. We Will Teach Web Development We are going to teach you how to build complete Web applications using Rails It’s a lot to cover and we don’t have time to do it all We will hit the basics
    22. 22. We Will Teach Web Development We are going to teach you how to build complete Web applications using Rails It’s a lot to cover and we don’t have time to do it all We will hit the basics We will dig deeper in some areas
    23. 23. We Will Teach Web Development We are going to teach you how to build complete Web applications using Rails It’s a lot to cover and we don’t have time to do it all We will hit the basics We will dig deeper in some areas We’re assuming you have minimal HTML, CSS, JavaScript, and programming knowledge
    24. 24. We Have Hands-on Labs
    25. 25. We Have Hands-on Labs Theory is great, and we will teach that about half of the time, but you learn Rails by building Rails applications
    26. 26. We Have Hands-on Labs Theory is great, and we will teach that about half of the time, but you learn Rails by building Rails applications This training is roughly half lab exercises
    27. 27. We Have Hands-on Labs Theory is great, and we will teach that about half of the time, but you learn Rails by building Rails applications This training is roughly half lab exercises You will build a working Rails application over the next three days
    28. 28. We Have Hands-on Labs Theory is great, and we will teach that about half of the time, but you learn Rails by building Rails applications This training is roughly half lab exercises You will build a working Rails application over the next three days Make some new friends and work together!
    29. 29. We Have Hands-on Labs Theory is great, and we will teach that about half of the time, but you learn Rails by building Rails applications This training is roughly half lab exercises You will build a working Rails application over the next three days Make some new friends and work together! I promise you will both learn more that way!
    30. 30. We are Interactive
    31. 31. We are Interactive Wake up!
    32. 32. We are Interactive Wake up! We like questions
    33. 33. We are Interactive Wake up! We like questions Everyone benefits if we turn this into more of a discussion and less of a lecture
    34. 34. We are Interactive Wake up! We like questions Everyone benefits if we turn this into more of a discussion and less of a lecture Help us
    35. 35. We are Interactive Wake up! We like questions Everyone benefits if we turn this into more of a discussion and less of a lecture Help us Please stop us with questions as you have them
    36. 36. Ruby on Rails What exactly is this “Rails” thing?
    37. 37. Software Moved Online
    38. 38. Software Moved Online Ruby on Rails is a framework for building web applications (interactive Web sites)
    39. 39. Software Moved Online Ruby on Rails is a framework for building web applications (interactive Web sites) Web development has exploded
    40. 40. Software Moved Online Ruby on Rails is a framework for building web applications (interactive Web sites) Web development has exploded Think about how many boxed software applications you buy now verses how many Web sites you use
    41. 41. Software Moved Online Ruby on Rails is a framework for building web applications (interactive Web sites) Web development has exploded Think about how many boxed software applications you buy now verses how many Web sites you use Social networking is huge (Twitter, Facebook, …)
    42. 42. Software Moved Online Ruby on Rails is a framework for building web applications (interactive Web sites) Web development has exploded Think about how many boxed software applications you buy now verses how many Web sites you use Social networking is huge (Twitter, Facebook, …) Many mobile applications use Rails as a backend
    43. 43. Rails is Ruby, right?
    44. 44. Rails is Ruby, right? Wrong!
    45. 45. Rails is Ruby, right? Wrong! Ruby is a programming language The Ruby Programming Language
    46. 46. Rails is Ruby, right? Wrong! Ruby is a programming The Ruby on Rails language Application Ruby on Rails, or Rails Framework for short, is a The Ruby framework written in Programming Ruby Language
    47. 47. Rails is Ruby, right? Wrong! Ruby is a programming The Ruby on Rails language Application Ruby on Rails, or Rails Framework for short, is a The Ruby framework written in Programming Ruby Language You will use both
    48. 48. The Ruby Programming Language
    49. 49. The Ruby Programming Language Created in Japan in 1995 by Yukihiro Matsumoto (“we call him “matz”)
    50. 50. The Ruby Programming Language Created in Japan in 1995 by Yukihiro Matsumoto (“we call him “matz”) It’s a few months older than Java, not new
    51. 51. The Ruby Programming Language Created in Japan in 1995 by Yukihiro Matsumoto (“we call him “matz”) It’s a few months older than Java, not new Is high level with many modern features: Objects, Exception handling, Garbage collection, …
    52. 52. The Ruby Programming Language Created in Japan in 1995 by Yukihiro Matsumoto (“we call him “matz”) It’s a few months older than Java, not new Is high level with many modern features: Objects, Exception handling, Garbage collection, … It’s very dynamic and expressive, literally allowing you to mold it to your specific needs
    53. 53. The Ruby on Rails Application Framework
    54. 54. The Ruby on Rails Application Framework Created in 2003 by David Heinemeier Hansson (we call him “DHH”)
    55. 55. The Ruby on Rails Application Framework Created in 2003 by David Heinemeier Hansson (we call him “DHH”) Rails was extracted from the real world application Basecamp
    56. 56. The Ruby on Rails Application Framework Created in 2003 by David Heinemeier Hansson (we call him “DHH”) Rails was extracted from the real world application Basecamp It adds Web needs to Ruby: requests and responses, routing, database modeling, …
    57. 57. The Ruby on Rails Application Framework Created in 2003 by David Heinemeier Hansson (we call him “DHH”) Rails was extracted from the real world application Basecamp It adds Web needs to Ruby: requests and responses, routing, database modeling, … It also modifies Ruby’s core in quite a few places to better suit the problem domain of Web applications
    58. 58. Railsisms Rails is very opinionated software!
    59. 59. The Rails Way
    60. 60. The Rails Way Rails often has a preferred approach to a task and it assumes you will be taking that approach
    61. 61. The Rails Way Rails often has a preferred approach to a task and it assumes you will be taking that approach You can almost always choose to do things the non- Rails way
    62. 62. The Rails Way Rails often has a preferred approach to a task and it assumes you will be taking that approach You can almost always choose to do things the non- Rails way However, this will not be as easy
    63. 63. The Rails Way Rails often has a preferred approach to a task and it assumes you will be taking that approach You can almost always choose to do things the non- Rails way However, this will not be as easy The path of least pain is definitely to do things the Rails way whenever possible
    64. 64. Convention Over Configuration
    65. 65. Convention Over Configuration Rails has considerably less configuration files than many other Web frameworks
    66. 66. Convention Over Configuration Rails has considerably less configuration files than many other Web frameworks Instead of always asking, Rails will assume you are following conventions (no configuration needed)
    67. 67. Convention Over Configuration Rails has considerably less configuration files than many other Web frameworks Instead of always asking, Rails will assume you are following conventions (no configuration needed) This makes following the conventions easy
    68. 68. Convention Over Configuration Rails has considerably less configuration files than many other Web frameworks Instead of always asking, Rails will assume you are following conventions (no configuration needed) This makes following the conventions easy If you need to break conventions, things will be less easy
    69. 69. MVC Architecture
    70. 70. MVC Architecture Rails separates code:
    71. 71. MVC Architecture Rails separates code: Database Models (database– Models business logic)
    72. 72. MVC Architecture Rails separates code: Database Models (database– Models business logic) Views (Web pages, RSS feeds, …) View Browser
    73. 73. MVC Architecture Rails separates code: Database Models (database– Models business logic) Views (Web pages, Controller RSS feeds, …) View Controllers (manage communication) Browser
    74. 74. Rails Cares How You Code
    75. 75. Rails Cares How You Code DRY
    76. 76. Rails Cares How You Code DRY Don’t Repeat Yourself
    77. 77. Rails Cares How You Code DRY Don’t Repeat Yourself Rails has tools to help you avoid repeating code
    78. 78. Rails Cares How You Code DRY Don’t Repeat Yourself Rails has tools to help you avoid repeating code YAGNI
    79. 79. Rails Cares How You Code DRY Don’t Repeat Yourself Rails has tools to help you avoid repeating code YAGNI You Ain’t Gonna Need It
    80. 80. Rails Cares How You Code DRY Don’t Repeat Yourself Rails has tools to help you avoid repeating code YAGNI You Ain’t Gonna Need It Rails is agile and can help you change as needed
    81. 81. Rails Cares How You Code DRY Don’t Repeat Yourself Rails has tools to help you avoid repeating code YAGNI You Ain’t Gonna Need It Rails is agile and can help you change as needed Rails encourages TDD (Test Driven Development)
    82. 82. The Anatomy of a Rails Project Let’s take a first look at how Rails prefers to keep its house
    83. 83. Starting a Rails Project
    84. 84. Starting a Rails Project $ rails -d sqlite3 my_project Ask Rails to create create create app/controllers things for you, so it can create app/helpers create app/models do it the way it prefers create app/views/layouts create config/environments create config/initializers create config/locales create db create doc create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create test/fixtures create test/functional create test/integration …
    85. 85. Starting a Rails Project $ rails -d sqlite3 my_project Ask Rails to create create create app/controllers things for you, so it can create app/helpers create app/models do it the way it prefers create app/views/layouts create config/environments create config/initializers create config/locales To start a project, just create db create doc name it create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create test/fixtures create test/functional create test/integration …
    86. 86. Starting a Rails Project $ rails -d sqlite3 my_project Ask Rails to create create create app/controllers things for you, so it can create app/helpers create app/models do it the way it prefers create app/views/layouts create config/environments create config/initializers create config/locales To start a project, just create db create doc name it create lib create lib/tasks create log Optionally, you can create public/images create public/javascripts create public/stylesheets choose a database create script/performance create test/fixtures create test/functional create test/integration …
    87. 87. Starting a Rails Project $ rails -d sqlite3 my_project Ask Rails to create create create app/controllers things for you, so it can create app/helpers create app/models do it the way it prefers create app/views/layouts create config/environments create config/initializers create config/locales To start a project, just create db create doc name it create lib create lib/tasks create log Optionally, you can create public/images create public/javascripts create public/stylesheets choose a database create script/performance create test/fixtures create test/functional SQLite is simple create test/integration …
    88. 88. The app/ Directory
    89. 89. The app/ Directory The heart of your application
    90. 90. The app/ Directory The heart of your application You can see the MVC design in here
    91. 91. The app/ Directory The heart of your application You can see the MVC design in here Helpers relate to views
    92. 92. The lib/ and vendor/ Directories
    93. 93. The lib/ and vendor/ Directories lib/ is for library code shared by your entire application
    94. 94. The lib/ and vendor/ Directories lib/ is for library code shared by your entire application It also holds maintenance tasks
    95. 95. The lib/ and vendor/ Directories lib/ is for library code shared by your entire application It also holds maintenance tasks vendor/ is for third party extensions (“gems”) or plugins
    96. 96. The test/ Directory
    97. 97. The test/ Directory Rails encourages you to test your application on multiple levels
    98. 98. The test/ Directory Rails encourages you to test your application on multiple levels It also provides tools for loading test data and doing performance testing
    99. 99. The public/ Directory
    100. 100. The public/ Directory For static assets:
    101. 101. The public/ Directory For static assets: Static HTML pages
    102. 102. The public/ Directory For static assets: Static HTML pages Error Pages
    103. 103. The public/ Directory For static assets: Static HTML pages Error Pages Images and CSS
    104. 104. The public/ Directory For static assets: Static HTML pages Error Pages Images and CSS JavaScript (Prototype and script.aculo.us included)
    105. 105. The config/ Directory
    106. 106. The config/ Directory Where you can change Rails configuration
    107. 107. The config/ Directory Where you can change Rails configuration It’s all set to conventions for you
    108. 108. The config/ Directory Where you can change Rails configuration It’s all set to conventions for you Note that Rails can run in three different modes
    109. 109. config/database.yml Rails configures a different database for each environment
    110. 110. # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000 config/database.yml Rails configures a different database for each environment
    111. 111. # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000 config/database.yml Rails configures a different database for each environment
    112. 112. The log/ Directory
    113. 113. The log/ Directory Rails logs events from each of its environments
    114. 114. The log/ Directory Rails logs events from each of its environments This helps debug issues
    115. 115. The log/ Directory Rails logs events from each of its environments This helps debug issues It can also be used for statistics tracking
    116. 116. The Rakefile and script/ Directory
    117. 117. The Rakefile and script/ Directory Rails has scripts for:
    118. 118. The Rakefile and script/ Directory Rails has scripts for: Creating new models and controllers
    119. 119. The Rakefile and script/ Directory Rails has scripts for: Creating new models and controllers Interactively working with your models
    120. 120. The Rakefile and script/ Directory Rails has scripts for: Creating new models and controllers Interactively working with your models Installing plugins
    121. 121. The Rakefile and script/ Directory Rails has scripts for: Creating new models and controllers Interactively working with your models Installing plugins Running your code
    122. 122. The Rakefile and script/ Directory Rails has scripts for: Creating new models and controllers Interactively working with your models Installing plugins Running your code Maintenance tasks
    123. 123. script/server Launching your Rails application is as simple as triggering the server script
    124. 124. $ cd my_project $ script/server => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server script/server Launching your Rails application is as simple as triggering the server script
    125. 125. $ cd my_project $ script/server => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server script/server Launching your Rails application is as simple as triggering the server script
    126. 126. Rails Up and Running Browse to http://localhost:3000/ to see your application running
    127. 127. Questions?
    128. 128. Creating a Rails Application Lab Your book has instructions for getting started with a Rails application: team up and try it!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×