From 2bae20138a4e3cb37ce26e396a4b14455a947ba2 Mon Sep 17 00:00:00 2001 From: Rohit Arondekar Date: Mon, 19 Apr 2010 02:15:04 -0700 Subject: Replaced ',' with 'or' to make it read better. --- railties/guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source/getting_started.textile') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index cbace177f9..58f2eaf178 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -87,7 +87,7 @@ Action View manages the views of your Rails application. It can create both HTML h5. Action Dispatch -Action Dispatch handles routing of web requests and dispatches them as you want, either to your application, any other Rack application. +Action Dispatch handles routing of web requests and dispatches them as you want, either to your application or any other Rack application. h5. Action Mailer -- cgit v1.2.3 From 3948ba89e143eeebb8a2a9bd5f370abb66a47377 Mon Sep 17 00:00:00 2001 From: Rohit Arondekar Date: Mon, 19 Apr 2010 02:54:50 -0700 Subject: Fixed wrong purpose of _form.html.erb --- railties/guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source/getting_started.textile') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 58f2eaf178..6cc989d156 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -363,7 +363,7 @@ The scaffold generator will build 15 files in your application, along with some |app/views/posts/edit.html.erb |A view to edit an existing post| |app/views/posts/show.html.erb |A view to display a single post| |app/views/posts/new.html.erb |A view to create a new post| -|app/views/posts/_form.html.erb |A view to control the overall look and feel of the other posts views| +|app/views/posts/_form.html.erb |A partial to control the overall look and feel of the form used in edit and new views| |app/views/layouts/posts.html.erb |A view to control the overall look and feel of the other posts views| |test/functional/posts_controller_test.rb |Functional testing harness for the posts controller| |app/helpers/posts_helper.rb |Helper functions to be used from the posts views| -- cgit v1.2.3 From a870c4928cac8bf14ddbda487108bce45bed0fa2 Mon Sep 17 00:00:00 2001 From: Rohit Arondekar Date: Mon, 19 Apr 2010 03:12:52 -0700 Subject: Cleaned up the table of files created by scaffolding a Post. --- railties/guides/source/getting_started.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties/guides/source/getting_started.textile') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 6cc989d156..09190f5800 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -356,7 +356,6 @@ The scaffold generator will build 15 files in your application, along with some |_.File |_.Purpose| |db/migrate/20100207214725_create_posts.rb.rb |Migration to create the posts table in your database (your name will include a different timestamp)| |app/models/post.rb |The Post model| -|test/unit/post_test.rb |Unit testing harness for the posts model| |test/fixtures/posts.yml |Dummy posts for use in testing| |app/controllers/posts_controller.rb |The Posts controller| |app/views/posts/index.html.erb |A view to display an index of all posts | @@ -364,11 +363,12 @@ The scaffold generator will build 15 files in your application, along with some |app/views/posts/show.html.erb |A view to display a single post| |app/views/posts/new.html.erb |A view to create a new post| |app/views/posts/_form.html.erb |A partial to control the overall look and feel of the form used in edit and new views| -|app/views/layouts/posts.html.erb |A view to control the overall look and feel of the other posts views| +|app/views/layouts/posts.html.erb |A view to control the overall look and feel of the other post views| +|app/helpers/posts_helper.rb |Helper functions to be used from the post views| +|test/unit/post_test.rb |Unit testing harness for the posts model| |test/functional/posts_controller_test.rb |Functional testing harness for the posts controller| -|app/helpers/posts_helper.rb |Helper functions to be used from the posts views| -|config/routes.rb |Edited to include routing information for posts| |test/unit/helpers/posts_helper_test.rb |Unit testing harness for the posts helper| +|config/routes.rb |Edited to include routing information for posts| |public/stylesheets/scaffold.css |Cascading style sheet to make the scaffolded views look better| h4. Running a Migration -- cgit v1.2.3 From adda7516e91943f940136cbfe0a0a0b89b65fb82 Mon Sep 17 00:00:00 2001 From: Rohit Arondekar Date: Tue, 20 Apr 2010 02:07:16 -0700 Subject: minor fix and re-organized description of index action --- railties/guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/guides/source/getting_started.textile') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 09190f5800..c33d50d055 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -395,7 +395,7 @@ class CreatePosts < ActiveRecord::Migration end -The above migration creates two methods, +up+, called when you run this migration into the database, and +down+ in case you need to reverse the changes made by this migration at a later date. The +up+ command in this case creates a +posts+ table with two string columns and a text column. It also is creating two timestamp fields to track record creation and updating. More information about Rails migrations can be found in the "Rails Database Migrations":migrations.html guide. +The above migration creates two methods, +up+, called when you run this migration into the database, and +down+ in case you need to reverse the changes made by this migration at a later date. The +up+ command in this case creates a +posts+ table with two string columns and a text column. It also creates two timestamp fields to track record creation and updating. More information about Rails migrations can be found in the "Rails Database Migrations":migrations.html guide. At this point, you can use a rake command to run the migration: @@ -504,7 +504,7 @@ def index end -This code sets the +@posts+ instance variable to an array of all posts in the database. +Post.all+ calls the +Post+ model to return all of the posts that are currently in the database, with no limiting conditions. ++Post.all+ calls the +Post+ model to return all of the posts currently in the database. The result of this call is an array containing the posts which has been saved 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. -- cgit v1.2.3 From 606bed1a77e0a0a2baf81d1866c66100de443701 Mon Sep 17 00:00:00 2001 From: Rohit Arondekar Date: Tue, 20 Apr 2010 23:23:32 -0700 Subject: Replaced f.error_messages with the new code as generated by rails 3 b3 --- railties/guides/source/getting_started.textile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'railties/guides/source/getting_started.textile') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index c33d50d055..8538d38374 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -603,7 +603,16 @@ If you take a look at +views/posts/_form.html.erb+ file, you will see the follow <%= form_for(@post) do |f| %> - <%= f.error_messages %> + <% if @post.errors.any? %> +
+

<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:

+
    + <% @post.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %>
<%= f.label :name %>
-- cgit v1.2.3 From a5955196f2ed8a69c49a1a8c0c617ab91cb8d716 Mon Sep 17 00:00:00 2001 From: Rohit Arondekar Date: Sat, 24 Apr 2010 21:51:25 -0700 Subject: Removed mentions of controller specific layouts. Ticket Ref: http://bit.ly/9dqvBI --- railties/guides/source/getting_started.textile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'railties/guides/source/getting_started.textile') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 8538d38374..6052ac737a 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -363,7 +363,6 @@ The scaffold generator will build 15 files in your application, along with some |app/views/posts/show.html.erb |A view to display a single post| |app/views/posts/new.html.erb |A view to create a new post| |app/views/posts/_form.html.erb |A partial to control the overall look and feel of the form used in edit and new views| -|app/views/layouts/posts.html.erb |A view to control the overall look and feel of the other post views| |app/helpers/posts_helper.rb |Helper functions to be used from the post views| |test/unit/post_test.rb |Unit testing harness for the posts model| |test/functional/posts_controller_test.rb |Functional testing harness for the posts controller| @@ -551,19 +550,19 @@ TIP: For more details on the rendering process, see "Layouts and Rendering in Ra h4. Customizing the Layout -The view is only part of the story of how HTML is displayed in your web browser. Rails also has the concept of +layouts+, which are containers for views. When Rails renders a view to the browser, it does so by putting the view's HTML into a layout's HTML. The +rails generate scaffold+ command automatically created a default layout, +app/views/layouts/posts.html.erb+, for the posts. Open this layout in your editor and modify the +body+ tag: +The view is only part of the story of how HTML is displayed in your web browser. Rails also has the concept of +layouts+, which are containers for views. When 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. A 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: - Posts: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> + Blog + <%= stylesheet_link_tag :all %> + <%= javascript_include_tag :defaults %> + <%= csrf_meta_tag %> -

<%= notice %>

- <%= yield %> -- cgit v1.2.3