Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[getting started] Split up creation of route, action and view for Pos…

  • Loading branch information...
commit 533bcd75d392cd1e0a9fcc5976237e877953477d 1 parent 0666e7b
@radar radar authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 guides/source/getting_started.textile
10 guides/source/getting_started.textile
@@ -560,19 +560,21 @@ be able to create a post. Try it!
h4. Listing all posts
We still need a way to list all our posts, so let's do that. As usual,
-we'll need a route, a controller action, and a view:
+we'll need a route placed into +config/routes.rb+:
-# Add to config/routes.rb
get "posts" => "posts#index"
+And an action for that route inside the +PostsController+ in the +app/controllers/posts_controller.rb+ file:
-# Add to app/controllers/posts_controller.rb
def index
@posts = Post.all
+And then finally a view for this action, located at +app/views/posts/index.html.erb+:
<h1>Listing posts</h1>
Please sign in to comment.
Something went wrong with that request. Please try again.