diff options
author | Xavier Noria <fxn@hashref.com> | 2010-12-29 23:46:03 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-12-29 23:46:03 +0100 |
commit | 69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2 (patch) | |
tree | cbff92b476133e56dfdc4cfbdf2f5ecb6cfca2c3 /railties/guides/source/action_view_overview.textile | |
parent | 0ac66caac5581c4793d120c8ad4a2cf4137f6ce2 (diff) | |
parent | 6f58b9ad5331d3619fc68a4706d5f85a95510a63 (diff) | |
download | rails-69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2.tar.gz rails-69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2.tar.bz2 rails-69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'railties/guides/source/action_view_overview.textile')
-rw-r--r-- | railties/guides/source/action_view_overview.textile | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index 30faeeaa91..e1fc0e7732 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -367,14 +367,14 @@ This helper makes building an ATOM feed easy. Here's a full usage example: *config/routes.rb* <ruby> -map.resources :posts +resources :posts </ruby> *app/controllers/posts_controller.rb* <ruby> def index - @posts = Post.find(:all) + @posts = Post.all respond_to do |format| format.html @@ -439,7 +439,7 @@ The +capture+ method allows you to extract part of a template into a variable. Y <% @greeting = capture do %> <p>Welcome! The date and time is <%= Time.now %></p> <% end %> -<ruby> +</ruby> The captured variable can then be used anywhere else. @@ -809,7 +809,7 @@ end Sample usage (selecting the associated Author for an instance of Post, +@post+): <ruby> -collection_select(:post, :author_id, Author.find(:all), :id, :name_with_initial, {:prompt => true}) +collection_select(:post, :author_id, Author.all, :id, :name_with_initial, {:prompt => true}) </ruby> If @post.author_id is already 1, this would return: @@ -910,7 +910,7 @@ Create a select tag and a series of contained option tags for the provided objec Example with @post.person_id => 1: <ruby> -select("post", "person_id", Person.find(:all).collect {|p| [ p.name, p.id ] }, { :include_blank => true }) +select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) </ruby> could become: |