From 0dad3ed4c630e9337c02d9aa6e3ea2e5cd613211 Mon Sep 17 00:00:00 2001 From: Sammy Larbi Date: Sat, 29 Dec 2012 11:11:45 -0600 Subject: Document JoinTable migration generator --- guides/source/migrations.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'guides/source') diff --git a/guides/source/migrations.md b/guides/source/migrations.md index f2aa72492f..1ce132e02d 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -202,6 +202,25 @@ end This migration will create a `user_id` column and appropriate index. +There is also a generator which will produce join tables if `JoinTable` is part of the name: + +```bash +rails g migration CreateJoinTableCustomerProduct customer product +``` + +will produce the following migration: + +```ruby +class CreateJoinTableCustomerProduct < ActiveRecord::Migration + def change + create_join_table :customers, :products do |t| + # t.index [:customer_id, :product_id] + # t.index [:product_id, :customer_id] + end + end +end +``` + ### Model Generators The model and scaffold generators will create migrations appropriate for adding -- cgit v1.2.3 From 9a497582e666b20cf38b87bf8beb64e60d3ed564 Mon Sep 17 00:00:00 2001 From: Nishant Modak Date: Sun, 30 Dec 2012 02:33:57 +0530 Subject: Update documentation for yml usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update documentation for yml usage against https://github.com/rails/rails/issues/8612 --- guides/source/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/testing.md b/guides/source/testing.md index a9bce04522..f178ca87e9 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -77,7 +77,7 @@ steve: profession: guy with keyboard ``` -Each fixture is given a name followed by an indented list of colon-separated key/value pairs. Records are typically separated by a blank space. You can place comments in a fixture file by using the # character in the first column. +Each fixture is given a name followed by an indented list of colon-separated key/value pairs. Records are typically separated by a blank space. You can place comments in a fixture file by using the # character in the first column. Keys which resemble YAML keywords such as 'yes' and 'no' are quoted so that the YAML Parser correctly interprets them. #### ERB'in It Up -- cgit v1.2.3 From 06c7ecb4ef21bf8a91c95e67f5528f0d90f6cf75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ove=C4=8Dka?= Date: Sun, 30 Dec 2012 15:07:36 +0100 Subject: Update guides/source/layouts_and_rendering.md Removed first slash. The subdirectory will nto be found with slash befor it. --- guides/source/layouts_and_rendering.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index dbaa3ec576..0875941e29 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -782,7 +782,7 @@ To include `app/assets/stylesheets/main.css` and `app/assets/stylesheets/columns To include `app/assets/stylesheets/main.css` and `app/assets/stylesheets/photos/columns.css`: ```erb -<%= stylesheet_link_tag "main", "/photos/columns" %> +<%= stylesheet_link_tag "main", "photos/columns" %> ``` To include `http://example.com/main.css`: -- cgit v1.2.3 From 46af32aa50cb9fda2cbefb124ef0adf3116137ec Mon Sep 17 00:00:00 2001 From: Joey Schoblaska Date: Sun, 30 Dec 2012 16:47:19 -0600 Subject: fixed inconsistent `require 'test_helper'` in testing guide --- guides/source/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/testing.md b/guides/source/testing.md index f178ca87e9..7747318d32 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -830,7 +830,7 @@ Above, the `setup` method is called before each test and so `@post` is available Let's see the earlier example by specifying `setup` callback by specifying a method name as a symbol: ```ruby -require '../test_helper' +require 'test_helper' class PostsControllerTest < ActionController::TestCase -- cgit v1.2.3 From 3511e3f449357107f9599549438147b2cadbb8e1 Mon Sep 17 00:00:00 2001 From: Jonathan Baudanza Date: Sun, 30 Dec 2012 20:21:20 -0800 Subject: Update guides/source/rails_on_rack.md Rack::Lock actually sets rack.multithread to `false`, not `true`. Presumably because once inside the mutex, the app can function as if it were single threaded. --- guides/source/rails_on_rack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md index 1fac6d9883..ac355b4a08 100644 --- a/guides/source/rails_on_rack.md +++ b/guides/source/rails_on_rack.md @@ -229,7 +229,7 @@ Much of Action Controller's functionality is implemented as Middlewares. The fol **`Rack::Lock`** -* Sets `env["rack.multithread"]` flag to `true` and wraps the application within a Mutex. +* Sets `env["rack.multithread"]` flag to `false` and wraps the application within a Mutex. **`ActiveSupport::Cache::Strategy::LocalCache::Middleware`** -- cgit v1.2.3 From f3dc158a018f8961650305626d1c3db025eac870 Mon Sep 17 00:00:00 2001 From: Ruafozy Date: Tue, 1 Jan 2013 10:22:18 +0000 Subject: Improve English * Fix one error * Improve wording * Improve punctuation --- guides/source/form_helpers.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'guides/source') diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index 8ab44ea0bb..12ef28668d 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -1,7 +1,7 @@ Form Helpers ============ -Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of form control naming and their numerous attributes. Rails deals away with these complexities by providing view helpers for generating form markup. However, since they have different use-cases, developers are required to know all the differences between similar helper methods before putting them to use. +Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of form control naming and their numerous attributes. Rails does away with these complexities by providing view helpers for generating form markup. However, since they have different use-cases, developers are required to know all the differences between similar helper methods before putting them to use. After reading this guide, you will know: @@ -148,7 +148,9 @@ Output: As with `check_box_tag`, the second parameter to `radio_button_tag` is the value of the input. Because these two radio buttons share the same name (age) the user will only be able to select one, and `params[:age]` will contain either "child" or "adult". -NOTE: Always use labels for checkbox and radio buttons. They associate text with a specific option and make it easier for users to click the inputs by expanding the clickable region. +NOTE: Always use labels for checkbox and radio buttons. They associate text with a specific option and, +by expanding the clickable region, +make it easier for users to click the inputs. ### Other Helpers of Interest @@ -534,7 +536,7 @@ The `:prefix` option is the key used to retrieve the hash of date components fro ### Model Object Helpers `select_date` does not work well with forms that update or create Active Record objects as Active Record expects each element of the `params` hash to correspond to one attribute. -The model object helpers for dates and times submit parameters with special names, when Active Record sees parameters with such names it knows they must be combined with the other parameters and given to a constructor appropriate to the column type. For example: +The model object helpers for dates and times submit parameters with special names; when Active Record sees parameters with such names it knows they must be combined with the other parameters and given to a constructor appropriate to the column type. For example: ```erb <%= date_select :person, :birth_date %> @@ -620,7 +622,7 @@ Unlike other forms making an asynchronous file upload form is not as simple as p Customizing Form Builders ------------------------- -As mentioned previously the object yielded by `form_for` and `fields_for` is an instance of FormBuilder (or a subclass thereof). Form builders encapsulate the notion of displaying form elements for a single object. While you can of course write helpers for your forms in the usual way you can also subclass FormBuilder and add the helpers there. For example +As mentioned previously the object yielded by `form_for` and `fields_for` is an instance of FormBuilder (or a subclass thereof). Form builders encapsulate the notion of displaying form elements for a single object. While you can of course write helpers for your forms in the usual way, you can also subclass FormBuilder and add the helpers there. For example ```erb <%= form_for @person do |f| %> @@ -805,7 +807,7 @@ Sometimes when you submit data to an external resource, like payment gateway, fi <% end %> ``` -The same technique is available for the `form_for` too: +The same technique is also available for `form_for`: ```erb <%= form_for @invoice, url: external_url, authenticity_token: 'external_token' do |f| %> -- cgit v1.2.3