aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2013-01-06 15:58:58 +0900
committerAkira Matsuda <ronnie@dio.jp>2013-01-06 15:58:58 +0900
commit253cdc8b5b9a627287491039e11ae2381d5f0fe8 (patch)
tree79361ec4ca81a12e7a379044fbf7becbdf44d865 /railties/lib
parent70ae89c321444eef42c0c011b522f926250e7acd (diff)
downloadrails-253cdc8b5b9a627287491039e11ae2381d5f0fe8.tar.gz
rails-253cdc8b5b9a627287491039e11ae2381d5f0fe8.tar.bz2
rails-253cdc8b5b9a627287491039e11ae2381d5f0fe8.zip
Update generated app's README [ci skip]
* a controller that destroying Weblogs might be WeblogsController * a controller that indexing Posts might be PostsController * Post.all returns a Relation * modernize Model.inspect results
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/README12
1 files changed, 5 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/README b/railties/lib/rails/generators/rails/app/templates/README
index 0ca71e3050..2bd7c27f2a 100644
--- a/railties/lib/rails/generators/rails/app/templates/README
+++ b/railties/lib/rails/generators/rails/app/templates/README
@@ -57,7 +57,7 @@ shown in the browser on requests from 127.0.0.1.
You can also log your own messages directly into the log file from your code
using the Ruby logger class from inside your controllers. Example:
- class WeblogController < ActionController::Base
+ class WeblogsController < ActionController::Base
def destroy
@weblog = Weblog.find(params[:id])
@weblog.destroy
@@ -89,7 +89,7 @@ execution at any point in the code, investigate and change the model, and then,
resume execution! You need to install the 'debugger' gem to run the server in debugging
mode. Add gem 'debugger' to your Gemfile and run <tt>bundle</tt> to install it. Example:
- class WeblogController < ActionController::Base
+ class PostsController < ActionController::Base
def index
@posts = Post.all
debugger
@@ -100,17 +100,15 @@ So the controller will accept the action, run the first line, then present you
with a IRB prompt in the server window. Here you can do things like:
>> @posts.inspect
- => "[#<Post:0x14a6be8
- @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
- #<Post:0x14a6620
- @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
+ => "#<ActiveRecord::Relation [#<Post id: 1, title: nil, body: nil>,
+ #<Post id: 2, title: \"Rails\", body: "Only ten..">]>"
>> @posts.first.title = "hello from a debugger"
=> "hello from a debugger"
...and even better, you can examine how your runtime objects actually work:
>> f = @posts.first
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ => #<Post id: 1, title: nil, body: nil>
>> f.
Display all 152 possibilities? (y or n)