diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-02-16 19:55:36 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-02-16 19:55:36 +0530 |
commit | 3e3ed1ede51f4d2f7f1d30b3754072b1121d5394 (patch) | |
tree | 4d721de7d9937cb2a0849b29738af8f29884240b /guides/source/getting_started.md | |
parent | 8b80e3c59c0b3cd788aa674508fff28d29fda6a0 (diff) | |
parent | 8e6d0fd4343cc68aab1e2b46363a930130fca6e5 (diff) | |
download | rails-3e3ed1ede51f4d2f7f1d30b3754072b1121d5394.tar.gz rails-3e3ed1ede51f4d2f7f1d30b3754072b1121d5394.tar.bz2 rails-3e3ed1ede51f4d2f7f1d30b3754072b1121d5394.zip |
Merge pull request #13937 from ktaragorn/guides_fixes
Guides fixes
Diffstat (limited to 'guides/source/getting_started.md')
-rw-r--r-- | guides/source/getting_started.md | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 5264f82b4b..53d2a9b55b 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1119,7 +1119,11 @@ The `method: :patch` option tells Rails that we want this form to be submitted via the `PATCH` HTTP method which is the HTTP method you're expected to use to **update** resources according to the REST protocol. -TIP: By default forms built with the _form_for_ helper are sent via `POST`. +The first parameter of the `form_tag` can be an object, say, `@article` which would +cause the helper to fill in the form with the fields of the object. Passing in a +symbol (`:article`) with the same name as the instance variable (`@article`) also +automagically leads to the same behavior. This is what is happening here. More details +can be found in [form_for documentation](http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for). Next we need to create the `update` action in `app/controllers/articles_controller.rb`: @@ -1390,7 +1394,9 @@ class CreateComments < ActiveRecord::Migration create_table :comments do |t| t.string :commenter t.text :body - t.references :article, index: true + + # this line adds an integer column called `article_id`. + t.references :article, index: true t.timestamps end |