aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorKarthik T <karthikt.holmes+github@gmail.com>2014-02-04 11:08:23 +0800
committerKarthik T <karthikt.holmes+github@gmail.com>2014-02-14 11:46:11 +0800
commit8e6d0fd4343cc68aab1e2b46363a930130fca6e5 (patch)
treea1a18a47de73ca96c37554fd07557f3dd650e9f9 /guides/source
parent28abd967fcc8544650c73910a8a0cbaa6dafc1f5 (diff)
downloadrails-8e6d0fd4343cc68aab1e2b46363a930130fca6e5.tar.gz
rails-8e6d0fd4343cc68aab1e2b46363a930130fca6e5.tar.bz2
rails-8e6d0fd4343cc68aab1e2b46363a930130fca6e5.zip
Getting started guide fixes & Explain X-SendFile a little better, with links
Explain how form_for :article is able to pull in the properties of @article Make it clear that article_id is generated due to the association set up Add link to the rails function that uses X-Sendfile. Add links to apache and nginx docs for the header
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/asset_pipeline.md7
-rw-r--r--guides/source/getting_started.md10
2 files changed, 14 insertions, 3 deletions
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 0422dda0d8..e67b7fe4cb 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -1018,7 +1018,8 @@ The X-Sendfile header is a directive to the web server to ignore the response
from the application, and instead serve a specified file from disk. This option
is off by default, but can be enabled if your server supports it. When enabled,
this passes responsibility for serving the file to the web server, which is
-faster.
+faster. Have a look at [send_file](http://api.rubyonrails.org/classes/ActionController/DataStreaming.html#method-i-send_file)
+on how to use this feature.
Apache and nginx support this option, which can be enabled in
`config/environments/production.rb`:
@@ -1033,6 +1034,10 @@ option, take care to paste this configuration option only into `production.rb`
and any other environments you define with production behavior (not
`application.rb`).
+TIP: For further details have a look at the docs of your production web server:
+- [Apache](https://tn123.org/mod_xsendfile/)
+- [Nginx](http://wiki.nginx.org/XSendfile)
+
Assets Cache Store
------------------
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index bdb1a61bfb..652ce1cd8d 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -1105,7 +1105,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`:
@@ -1376,7 +1380,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