1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

made a few changes and fixes in getting started guide [ci skip]

This commit is contained in:
Vijay Dev 2012-04-28 01:37:52 +05:30
parent 43af34c0f6
commit 4dcaffb04c

View file

@ -45,10 +45,6 @@ internet for learning Ruby, including:
h3. What is Rails?
TIP: This section goes into the background and philosophy of the Rails framework
in detail. You can safely skip this section and come back to it at a later time.
Section 3 starts you on the path to creating your first Rails application.
Rails is a web application development framework written in the Ruby language.
It is designed to make programming web applications easier by making assumptions
about what every developer needs to get started. It allows you to write less
@ -141,7 +137,7 @@ The +rails new blog+ command we ran above created a folder in your working direc
h3. Hello, Rails!
One of the traditional places to start with a new language is by getting some text up on screen quickly. To do this, you need to get your Rails application server running.
To begin with, let's get some text up on screen quickly. To do this, you need to get your Rails application server running.
h4. Starting up the Web Server
@ -153,7 +149,7 @@ $ rails server
TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the absence of a runtime will give you an +execjs+ error. Usually Mac OS X and Windows come with a JavaScript runtime installed. Rails adds the +therubyracer+ gem to Gemfile in a commented line for new apps and you can uncomment if you need it. +therubyrhino+ is the recommended runtime for JRuby users and is added by default to Gemfile in apps generated under JRuby. You can investigate about all the supported runtimes at "ExecJS":https://github.com/sstephenson/execjs#readme.
This will fire up an instance of a webserver built into Ruby called WEBrick by default. To see your application in action, open a browser window and navigate to "http://localhost:3000":http://localhost:3000. You should see the Rails default information page:
This will fire up WEBrick, a webserver built into Ruby by default. To see your application in action, open a browser window and navigate to "http://localhost:3000":http://localhost:3000. You should see the Rails default information page:
!images/rails_welcome.png(Welcome Aboard screenshot)!
@ -165,7 +161,7 @@ h4. Say "Hello", Rails
To get Rails saying "Hello", you need to create at minimum a _controller_ and a _view_.
A controller's purpose is to receive specific requests for the application. What controller receives what request is determined by the _routing_. There is very often more than one route to each controller, and different routes can be served by different _actions_. Each action's purpose is to collect information to provide it to a view.
A controller's purpose is to receive specific requests for the application. _Routing_ decides which controller receives which requests. Often, there is more than one route to each controller, and different routes can be served by different _actions_. Each action's purpose is to collect information to provide it to a view.
A view's purpose is to display this information in a human readable format. An important distinction to make is that it is the _controller_, not the view, where information is collected. The view should just display that information. By default, view templates are written in a language called ERB (Embedded Ruby) which is converted by the request cycle in Rails before being sent to the user.
@ -404,7 +400,7 @@ turn should have a title attribute of type string, and a text attribute
of type text. Rails in turn responded by creating a bunch of files. For
now, we're only interested in +app/models/post.rb+ and
+db/migrate/20120419084633_create_posts.rb+. The latter is responsible
for creating the dabase structure, which is what we'll look at next.
for creating the database structure, which is what we'll look at next.
h4. Running a Migration
@ -416,7 +412,7 @@ and it's possible to undo a migration after it's been applied to your database.
Migration filenames include a timestamp to ensure that they're processed in the
order that they were created.
If you look in the +db/migrate/20100207214725_create_posts.rb+ file (remember,
If you look in the +db/migrate/20120419084633_create_posts.rb+ file (remember,
yours will have a slightly different name), here's what you'll find:
<ruby>
@ -923,7 +919,7 @@ The +show+ view will automatically include the content of the
as to not be confused with regular views. However, you don't include the
underscore when including them with the +helper+ method.
TIP: You can red more about partials in the "Layouts and Rendering in
TIP: You can read more about partials in the "Layouts and Rendering in
Rails":layouts_and_rendering.html guide.
Our +edit+ action looks very similar to the +new+ action, in fact they