Permalink
Browse files

Briefly discuss the reason for the respond_to block generated by the …

…scaffold
  • Loading branch information...
1 parent 6f1c274 commit 6704e90c900555196080165c242d6999d1fcfaba @bensie bensie committed Sep 10, 2008
Showing with 3 additions and 0 deletions.
  1. +3 −0 railties/doc/guides/getting_started_with_rails/getting_started_with_rails.txt
@@ -292,6 +292,9 @@ def index
end
-----------------------------------------
+In this action, we're setting the `@posts` instance variable to a hash of all posts in the database. `Post.find(:all)` or `Post.all` (in Rails 2.1) calls on our model to return all the Posts in the database with no additional conditions.
+
+The `respond_to` block handles both HTML and XML calls to this action. If we call http://localhost:3000/posts.xml, we'll see all our posts in XML format. The HTML format looks for our corresponding view in `app/views/posts/index.html.erb`.
=== The View
The view is where you put all the code that gets seen by the user: divs, tables, text, checkboxes, etc. Think of the view as the home of your HTML. If done correctly, there should be no business logic in the view.

0 comments on commit 6704e90

Please sign in to comment.