diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-25 23:59:57 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-25 23:59:57 +0530 |
commit | 2801efbc3b3a5c5cf3406aa7063852a86898f547 (patch) | |
tree | 0c86cff577ea66f39aa8b43ecf28d6000ae2a71f /railties/guides/source/action_view_overview.textile | |
parent | c6b9e47d5c59554d13d7dabedb651c7bf69da56b (diff) | |
download | rails-2801efbc3b3a5c5cf3406aa7063852a86898f547.tar.gz rails-2801efbc3b3a5c5cf3406aa7063852a86898f547.tar.bz2 rails-2801efbc3b3a5c5cf3406aa7063852a86898f547.zip |
use all and first instead of find(:all) and find(:first)
Diffstat (limited to 'railties/guides/source/action_view_overview.textile')
-rw-r--r-- | railties/guides/source/action_view_overview.textile | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index 30faeeaa91..ffcc98f41b 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 @@ -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: |