aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/getting_started.md
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-09-21 23:23:34 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-09-21 23:34:36 +0530
commit25c3c89e97ebf61debc937687ff536c8316792ac (patch)
tree5ac26f32e39ac43f621b403e8691e5276f5e2f4d /guides/source/getting_started.md
parent3b7947ea31489afd020419e3c22ee01ce4809103 (diff)
downloadrails-25c3c89e97ebf61debc937687ff536c8316792ac.tar.gz
rails-25c3c89e97ebf61debc937687ff536c8316792ac.tar.bz2
rails-25c3c89e97ebf61debc937687ff536c8316792ac.zip
fix some md syntax errors and general revisions [ci skip]
Diffstat (limited to 'guides/source/getting_started.md')
-rw-r--r--guides/source/getting_started.md33
1 files changed, 16 insertions, 17 deletions
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index ccfef07090..28adad3855 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -24,9 +24,8 @@ with Rails. However, to get the most out of it, you need to have some
prerequisites installed:
* The [Ruby](http://www.ruby-lang.org/en/downloads) language version 1.9.3 or higher
-
* The [RubyGems](http://rubyforge.org/frs/?group_id=126) packaging system
- * If you want to learn more about RubyGems, please read the [RubyGems User Guide](http://docs.rubygems.org/read/book/1)
+ * To learn more about RubyGems, please read the [RubyGems User Guide](http://docs.rubygems.org/read/book/1)
* A working installation of the [SQLite3 Database](http://www.sqlite.org)
Rails is a web application framework running on the Ruby programming language.
@@ -208,11 +207,11 @@ Open the `app/views/welcome/index.html.erb` file in your text editor and edit it
### Setting the Application Home Page
-Now that we have made the controller and view, we need to tell Rails when we want [Hello Rails!" to show up. In our case, we want it to show up when we navigate to the root URL of our site, "http://localhost:3000](http://localhost:3000). At the moment, however, the "Welcome Aboard" smoke test is occupying that spot.
+Now that we have made the controller and view, we need to tell Rails when we want Hello Rails! to show up. In our case, we want it to show up when we navigate to the root URL of our site, [http://localhost:3000](http://localhost:3000). At the moment, however, the "Welcome Aboard" smoke test is occupying that spot.
To fix this, delete the `index.html` file located inside the `public` directory of the application.
-You need to do this because Rails will serve any static file in the `public` directory that matches a route in preference to any dynamic content you generate from the controllers. The `index.html` file is special: it will be served if a request comes in at the root route, e.g. http://localhost:3000. If another request such as http://localhost:3000/welcome happened, a static file at `public/welcome.html` would be served first, but only if it existed.
+You need to do this because Rails will serve any static file in the `public` directory that matches a route in preference to any dynamic content you generate from the controllers. The `index.html` file is special: it will be served if a request comes in at the root route, e.g. [http://localhost:3000](http://localhost:3000). If another request such as [http://localhost:3000/welcome](http://localhost:3000/welcome) happened, a static file at `public/welcome.html` would be served first, but only if it existed.
Next, you have to tell Rails where your actual home page is located.
@@ -402,7 +401,6 @@ class PostsController < ApplicationController
def create
end
-
end
```
@@ -811,17 +809,15 @@ with class `field_with_errors`. You can define a css rule to make them
standout.
Now you'll get a nice error message when saving a post without title when you
-attempt to do just that on the [new post form (http://localhost:3000/posts/new)](http://localhost:3000/posts/new).
+attempt to do just that on the new post form [(http://localhost:3000/posts/new)](http://localhost:3000/posts/new).
![Form With Errors](images/getting_started/form_with_errors.png)
### Updating Posts
-We've covered the "CR" part of CRUD. Now let's focus on the "U" part,
-updating posts.
+We've covered the "CR" part of CRUD. Now let's focus on the "U" part, updating posts.
-The first step we'll take is adding a `edit` action to
-`posts_controller`.
+The first step we'll take is adding a `edit` action to `posts_controller`.
Start by adding a route to `config/routes.rb`:
@@ -882,7 +878,7 @@ The `:method => :put` option tells Rails that we want this form to be
submitted via the `PUT`, HTTP method which is the HTTP method you're expected to use to
**update** resources according to the REST protocol.
-TIP: By default forms built with the +form_for_ helper are sent via `POST`.
+TIP: By default forms built with the _form_for_ helper are sent via `POST`.
Next, we need to add the `update` action. The file
`config/routes.rb` will need just one more line:
@@ -1332,8 +1328,8 @@ These two declarations enable a good bit of automatic behavior. For example, if
you have an instance variable `@post` containing a post, you can retrieve all
the comments belonging to that post as an array using `@post.comments`.
-TIP: For more information on Active Record associations, see the "Active Record
-Associations":association_basics.html guide.
+TIP: For more information on Active Record associations, see the [Active Record
+Associations](association_basics.html) guide.
### Adding a Route for Comments
@@ -1351,8 +1347,7 @@ This creates `comments` as a _nested resource_ within `posts`. This is another
part of capturing the hierarchical relationship that exists between posts and
comments.
-TIP: For more information on routing, see the "Rails Routing from the Outside
-In":routing.html guide.
+TIP: For more information on routing, see the [Rails Routing](routing.html) guide.
### Generating a Controller
@@ -1707,7 +1702,9 @@ class PostsController < ApplicationController
def index
@posts = Post.all
-# snipped for brevity
+ end
+
+ # snipped for brevity
```
We also only want to allow authenticated users to delete comments, so in the
@@ -1720,7 +1717,9 @@ class CommentsController < ApplicationController
def create
@post = Post.find(params[:post_id])
-# snipped for brevity
+ ...
+ end
+ # snipped for brevity
```
Now if you try to create a new post, you will be greeted with a basic HTTP