Commit Graph

167 Commits

Author SHA1 Message Date
Ryuta Kamizono
868bf88354
Merge pull request #37744 from seejohnrun/around_action-docs
Add guide for inline around_action
2019-12-05 11:38:33 +09:00
Ryuta Kamizono
93e154ac2c Titleize header [ci skip]
Sync style with Basic Authentication and Digest Authentication headers.
2019-11-24 10:07:08 +09:00
soartec-lab
bbcf0be6d8 Update guide missing "HTTP" of "HTTP Token authentication" [skip ci] 2019-11-21 17:34:25 +09:00
John Crepezzi
012b1e3281 Add guide for inline around_action
This commit adds a test to ensure the behavior of inline `around_action`
calls, as well as a change to the guides to call out this alternate use of
`around_action`.

Closes #37616
2019-11-20 12:03:41 -05:00
soartec-lab
61ba095260 Add HTTP Token authentication section to guide [skip ci] 2019-11-13 19:47:48 +09:00
Sharang Dashputre
18504eb78f Use a single term instead of all terms used to describe path and URL helpers together 2019-07-26 23:54:39 +05:30
Nathaniel Suchy
d9f1cc05b5 Update links and code examples in the guides to use HTTPS where the host supports it. 2019-03-06 15:21:07 -05:00
Ryuta Kamizono
713cee01a5 Fix typo a -> an, an -> a [ci skip] 2019-02-11 17:03:10 +09:00
Adam Demirel
4c15ed7753 Update snippet to rails 5 syntax 2018-10-15 15:14:48 +11:00
Mina Slater
f1d647aeff [ci skip] corrects more grammar awkwardness, replacing denylist with restricted list and consistently use permitted 2018-08-22 21:52:17 -05:00
Mina Slater
7bdf43daac [ci skip] fixes awkward grammar 2018-08-22 07:39:26 -05:00
Mina Slater
44da9eb3b9 [ci skip] change all instances of blacklist and whitelist to denylist and allowlist 2018-08-21 21:36:40 -05:00
Matthew Draper
ec387c6dd9
Merge pull request #33229 from albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
2018-07-25 04:10:29 +09:30
Paul McMahon
7b9c19d94b Rails guides are now served over https
http links will be redirected to the https version, but still better to
just directly link to the https version.
2018-07-24 11:29:31 +09:00
Alberto Almagro
40b209db53 Recommend use of rails over bin/rails
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.

We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
2018-07-06 22:46:35 +02:00
Michael Holroyd
17af429958
Update example for whitelisting arbitrary hashes
Since the ability to whitelist arbitrary hashes was added (https://github.com/rails/rails/issues/9454 was resolved by e86524c0c5), this example is no longer outside of what strong_params can do. Moved this specific example out of the "Outside the Scope" section and into the regular "Examples" section, but left the "Outside the Scope" section as it was since the advice is still relevant for weirder whitelisting situations (maybe someone wants to add a new example that can't be handled natively).
2018-06-14 16:14:47 -04:00
Anthony Crumley
258670244d Added a lot of Oxford commas
[ci skip] A regular expression was used to find a lot of missing Oxford
commas and add them.  The regular expression was as follows.

", ([a-zA-Z0-9.\`:'\"]+ ){1,6}(or|and) "
2018-05-10 12:46:06 -05:00
bogdanvlviv
d2fd01ec68
Fix title for example of removing data from session [ci skip]
After #31685 the description says different what
we expect to see in the example. Change `assign that key to be nil` to
`or delete the key/value pair` in order to highlight what is shown in the example.

Fix one more example of removing data from the session in favour of using
`delete` since assigning to `nil` doesn't delete key from it.
2018-04-23 21:59:39 +03:00
Rafael Barbolo
80cbf19453 Remove key from session by using session.delete (#31685)
* Remove key from session by using session.delete

You are not deleting a key from session when you assign nil to that key.

* Update guides on how to destroy a user session

In this commit, the user id is removed from session and controller's variables related to the user are nullified.

[Rafael Mendonça França + Rafael Barbolo]
2018-04-23 13:50:59 -04:00
Guillermo Iguaran
c680080967
Merge pull request #32277 from derekprior/dp-deprecate-force-ssl
Deprecate controller level force_ssl
2018-03-30 09:02:49 -05:00
Derek Prior
4701a50b58
Deprecate controller level force_ssl
Today there are two common ways for Rails developers to force their
applications to communicate over HTTPS:

* `config.force_ssl` is a setting in environment configurations that
  enables the `ActionDispatch::SSL` middleware. With this middleware
  enabled, all HTTP communication to your application will be redirected
  to HTTPS. The middleware also takes care of other best practices by
  setting HSTS headers, upgrading all cookies to secure only, etc.
* The `force_ssl` controller method redirects HTTP requests to certain
  controllers to HTTPS.

As a consultant, I've seen many applications with misconfigured HTTPS
setups due to developers adding `force_ssl` to `ApplicationController`
and not enabling `config.force_ssl`. With this configuration, many
application requests can be served over HTTP such as assets, requests
that hit mounted engines, etc. In addition, because cookies are not
upgraded to secure only in this configuration and HSTS headers are not
set, it's possible for cookies that are meant to be secure to be sent
over HTTP.

The confusion between these two methods of forcing HTTPS is compounded
by the fact that they share an identical name. This makes finding
documentation on the "right" method confusing.

HTTPS throughout is quickly becomming table stakes for all web sites.
Sites are expected to operate over HTTPS for all communication,
sensitive or otherwise. Let's encourage use of the broader-reaching
`ActionDispatch::SSL` middleware and elminate this source of user
confusion. If, for some reason, applications need to expose certain
endpoints over HTTP they can do so by properly configuring
`config.ssl_options`.
2018-03-30 09:58:28 -04:00
Isaac Orme
2273f5228a Readability fix [ci skip] 2018-03-25 13:02:11 -07:00
Yauheni Dakuka
f1b1494484 Fix note marks [ci skip] 2018-03-12 15:36:26 +03:00
Dixit Patel
ce180231d9 [ci skip] Update MVC wiki link 2017-11-28 16:42:11 +05:30
willnet
4db3449d34 [ci skip]Add space before closing curly brace 2017-10-25 13:29:18 +09:00
Yoshiyuki Hirano
639fded77b Use form_with instead of form_for in engine guide [ci skip] 2017-10-09 11:36:37 +09:00
Yauheni Dakuka
de2afdc457 Cosmetic fixes [ci skip] 2017-10-06 09:02:56 +03:00
Claudio B
2f8ecdb21d Use credentials, not secrets, for Active Storage (#30650)
According to #30067:

> This PR will deprecate secrets.yml* and instead adopt
> config/credentials.yml.enc to signify what these secrets are specifically
> for: Keeping API keys, database passwords, and any other integration
> credentials in one place.

[ci skip] since only comments are being edited.
2017-09-19 17:08:32 -05:00
Yauheni Dakuka
fe15175039 Update action_controller_overview.md [ci skip] 2017-09-19 11:42:19 +03:00
Kasper Timm Hansen
ca18922ac2
[ci skip] Prefer credentials to secrets in docs.
Removes most mentions of secrets.secret_key_base and explains
credentials instead.

Also removes some very stale upgrade notices about Rails 3/4.
2017-09-13 21:28:11 +02:00
Yoshiyuki Hirano
bf48e90e69 Use https instead of http in guide [ci skip] 2017-08-23 09:39:45 +09:00
Yuki Nishijima
57add37382 Fix english for the rescue_from warning [ci skip] 2017-07-11 12:54:36 -04:00
dixpac
4f39556577 Improving docs for callbacks execution order [ci skip]
When define callbacks latest definition on the same callback/method
overwrites previous ones.
2017-05-21 18:45:59 +02:00
Jon Moss
f77a6be8d2 Small grammar fix
Add comma and change verb.

[ci skip]
2017-03-29 16:14:06 -04:00
Frederik Wille
2b3a3738b7 add hint on after_action filters
Adds a hint that ``after_action``-callbacks are not executed when an
exception was raised in the rest of the request cycle. The
``before_action`` section mentions "If there are additional filters
scheduled to run after that filter, they are also cancelled." but this
is IMO not sufficient.
2017-03-29 15:51:12 +02:00
Kirill Zhuravlov
30433253ed Add link to API documentation
Add a link to http://api.rubyonrails.org/classes/ActionController.html in the beginning of an article.
2016-11-23 03:04:55 +02:00
Xavier Noria
e86524c0c5 adds support for arbitrary hashes in strong parameters 2016-11-11 23:31:50 +01:00
Prathamesh Sonpatki
e5a6f7ee9e
Setup default session store internally, no longer through an application initializer
- By default the session store will be set to cookie store with
  application name as session key.
- Older apps are not affected as they will have the session store
  initializer generated by Rails in older versions, and Rails will not
  overwrite the session store if it is already set or disabled.
- But new apps will not have the initializer, instead the session store
  will be set to cookie store by default.
- Based on comment by DHH here - https://github.com/rails/rails/issues/25181#issuecomment-222312764.
2016-07-17 19:45:51 +05:30
Jun Wan Goh
bce690a49e Add Rack doc link for request and response object [ci skip] 2016-06-14 23:48:51 +08:00
Vijay Dev
4e85538ddd Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/action_cable_overview.md
2016-06-03 14:00:47 +00:00
yuuji.yaginuma
5e87e1faf6 fix incorrect class name [ci skip] 2016-05-28 15:08:47 +09:00
Jon Moss
9c0791b045
Small grammar fixes for Action Controller Overview
[ci skip]
2016-05-21 11:16:52 -04:00
Andrew Babichev
02ead6437e [ci skip] Parameter filter performs regular expression partial matching 2016-03-31 18:15:44 +03:00
Sandeep Navghane
3c688c737b Update action_controller_overview.md 2016-03-15 13:49:40 +05:30
Gaurav Sharma
1474619196 [ci skip] update guide for Puma web server instead of Webrick
Rails 5.0 default server puma web server. following commit - https://github.com/rails/rails/commit/ae48ea69
2016-01-20 00:50:47 +05:30
Mauro George
43800057fc Add a note on ActionController guide about 404
[ci skip]
2016-01-11 19:27:19 -02:00
David Heinemeier Hansson
ea4f0e2bab Refer to rails command instead of rake in a bunch of places
Still more to do. Please assist!
2015-12-18 13:01:10 +01:00
Derek Prior
13fd5586ce
Add redirect_back for safer referrer redirects
`redirect_to :back` is a somewhat common pattern in Rails apps, but it
is not completely safe. There are a number of circumstances where HTTP
referrer information is not available on the request. This happens often
with bot traffic and occasionally to user traffic depending on browser
security settings.

When there is no referrer available on the request, `redirect_to :back`
will raise `ActionController::RedirectBackError`, usually resulting in
an application error.

`redirect_back` takes a required `fallback_location` keyword argument
that specifies the redirect when the referrer information is not
available.  This prevents 500 errors caused by
`ActionController::RedirectBackError`.
2015-12-16 11:42:05 -05:00
Bradley D
119f38f795 Change AbstractRequest to ActionDispatch::Request
AbstractRequest has been deprecated, updating to refer to ActionDispatch::Request instead.

[ci skip]
2015-09-17 16:43:51 -06:00
Lachlan Campbell
0ab07181c9 Remove RHTML reference in Action Controller docs [ci skip] 2015-09-10 20:25:48 -04:00