aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/getting_started.md
diff options
context:
space:
mode:
authorJason Noble <github+jasonn@jasonnoble.org>2012-11-24 22:24:29 -0700
committerJason Noble <github+jasonn@jasonnoble.org>2012-11-24 22:24:29 -0700
commita22fc4abf12f618b25cc2e127971d43d43eb98c4 (patch)
tree686fa83014b3d3b4c0cde314af5168948b62c4cb /guides/source/getting_started.md
parent85db49fd8d7a14cc0126f1a2516effbea33d715f (diff)
downloadrails-a22fc4abf12f618b25cc2e127971d43d43eb98c4.tar.gz
rails-a22fc4abf12f618b25cc2e127971d43d43eb98c4.tar.bz2
rails-a22fc4abf12f618b25cc2e127971d43d43eb98c4.zip
Changed the Using Partials section to read a little better
* No need to give a simple example, as we have a partial that we create in the blog app
Diffstat (limited to 'guides/source/getting_started.md')
-rw-r--r--guides/source/getting_started.md29
1 files changed, 4 insertions, 25 deletions
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 546230dbdd..6528759041 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -954,35 +954,14 @@ And here's how our app looks so far:
### Using partials to clean up duplication in views
-`partials` are what Rails uses to remove duplication in views. Here's a
-simple example:
-
-```html+erb
-# app/views/user/show.html.erb
-
-<h1><%= @user.name %></h1>
-
-<%= render 'user_details' %>
-
-# app/views/user/_user_details.html.erb
-
-<%= @user.location %>
-
-<%= @user.about_me %>
-```
-
-The `users/show` template will automatically include the content of the
-`users/_user_details` template. Note that partials are prefixed by an underscore,
-as to not be confused with regular views. However, you don't include the
-underscore when including them with the `helper` method.
+Our `edit` page looks very similar to the `new` page, in fact they
+both share the same code for displaying the form. Let's remove some duplication
+by using a view partial. By convention, partial files are prefixed by an
+underscore.
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
-both share the same code for displaying the form. Let's clean them up by
-using a partial.
-
Create a new file `app/views/posts/_form.html.erb` with the following
content: