Skip to content

Commit

Permalink
Make the guide more friendly
Browse files Browse the repository at this point in the history
- Changed Rails 3.0 to 3.0+
  • Loading branch information
jasonnoble committed Nov 13, 2011
1 parent 9b96f74 commit 3e3872b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions railties/guides/source/getting_started.textile
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,9 @@ while the console is open, type +reload!+ at the console prompt to load them.

h4. Listing All Posts

The easiest place to start looking at functionality is with the code that lists
all posts. Open the file +app/controllers/posts_controller.rb+ and look at the
Let's dive into the Rails code a little deeper to see how the application is
showing us the list of Posts. Open the file
+app/controllers/posts_controller.rb+ and look at the
+index+ action:

<ruby>
Expand All @@ -762,9 +763,9 @@ def index
end
</ruby>

+Post.all+ calls the +Post+ model to return all of the posts currently in the
database. The result of this call is an array of posts that we store in an
instance variable called +@posts+.
+Post.all+ calls the all method on the +Post+ model, which returns all of
the posts currently in the database. The result of this call is an array
of Post records that we store in an instance variable called +@posts+.

TIP: For more information on finding records with Active Record, see "Active
Record Query Interface":active_record_querying.html.
Expand Down Expand Up @@ -815,7 +816,7 @@ and links. A few things to note in the view:

NOTE. In previous versions of Rails, you had to use +&lt;%=h post.name %&gt;+ so
that any HTML would be escaped before being inserted into the page. In Rails
3.0, this is now the default. To get unescaped HTML, you now use +&lt;%= raw
3.0+, this is now the default. To get unescaped HTML, you now use +&lt;%= raw
post.name %&gt;+.

TIP: For more details on the rendering process, see "Layouts and Rendering in
Expand All @@ -829,9 +830,10 @@ Rails renders a view to the browser, it does so by putting the view's HTML into
a layout's HTML. In previous versions of Rails, the +rails generate scaffold+
command would automatically create a controller specific layout, like
+app/views/layouts/posts.html.erb+, for the posts controller. However this has
been changed in Rails 3.0. An application specific +layout+ is used for all the
been changed in Rails 3.0+. An application specific +layout+ is used for all the
controllers and can be found in +app/views/layouts/application.html.erb+. Open
this layout in your editor and modify the +body+ tag:
this layout in your editor and modify the +body+ tag to include the style directive
below:

<erb>
<!DOCTYPE html>
Expand Down

0 comments on commit 3e3872b

Please sign in to comment.