Commit Graph

56867 Commits

Author SHA1 Message Date
claudiob
d57fa1fbf3 Doc: update routes guides for Rails 5
[ci skip]
2016-02-25 08:20:15 -08:00
Joe Rafaniello
0379da6abc Fix uniqueness validation with an after_create hook.
record.id_was is nil in after_create/after_save, so we should use
id in these cases.

While this logic feels incomplete, the existing update_record uses the same
logic:
2fda4e0874/activerecord/lib/active_record/relation.rb (L83)

This logic was originally added for a similar problem:
updates not working with after_create hook.

See: 482f8c15b1d699c95bfbc3d836f674a09c0d9031

Followup to #23581
Fixes #23844
2016-02-25 10:13:12 -05:00
Andrew White
2fda4e0874 Merge pull request #23874 from st0012/update-documents
[ci skip] Update configuration guide
2016-02-25 13:54:01 +00:00
Kasper Timm Hansen
46cb45df48 Additional review of 6b31761.
* Fixes typos in error message and release notes.
* Removes unused template test file.
2016-02-25 11:13:42 +01:00
Godfrey Chan
6b3176170a Merge pull request #23827 from rails/new_implicit_render
Lock down new `ImplicitRender` behavior for 5.0 RC
2016-02-25 01:30:00 -08:00
Godfrey Chan
73b1efc58f Lock down new ImplicitRender behavior for 5.0 RC
1. Conceptually revert #20276

   The feature was implemented for the `responders` gem. In the end,
   they did not need that feature, and have found a better fix (see
   plataformatec/responders#131).

   `ImplicitRender` is the place where Rails specifies our default
   policies for the case where the user did not explicitly tell us
   what to render, essentially describing a set of heuristics. If
   the gem (or the user) knows exactly what they want, they could
   just perform the correct `render` to avoid falling through to
   here, as `responders` did (the user called `respond_with`).

   Reverting the patch allows us to avoid exploding the complexity
   and defining “the fallback for a fallback” policies.

2. `respond_to` and templates are considered exhaustive enumerations

   If the user specified a list of formats/variants in a `respond_to`
   block, anything that is not explicitly included should result
   in an `UnknownFormat` error (which is then caught upstream to
   mean “406 Not Acceptable” by default). This is already how it
   works before this commit.

   Same goes for templates – if the user defined a set of templates
   (usually in the file system), that set is now considered exhaustive,
   which means that “missing” templates are considered `UnknownFormat`
   errors (406).

3. To keep API endpoints simple, the implicit render behavior for
   actions with no templates defined at all (regardless of formats,
   locales, variants, etc) are defaulted to “204 No Content”. This
   is a strictly narrower version of the feature landed in #19036 and
   #19377.

4. To avoid confusion when interacting in the browser, these actions
   will raise an `UnknownFormat` error for “interactive” requests
   instead. (The precise definition of “interactive” requests might
   change – the spirit here is to give helpful messages and avoid
   confusions.)

Closes #20666, #23062, #23077, #23564

[Godfrey Chan, Jon Moss, Kasper Timm Hansen, Mike Clark, Matthew Draper]
2016-02-25 01:19:49 -08:00
Stan Lo
d0c8117ced Add config.debug_exception_response_format into configuration guide 2016-02-25 13:45:09 +08:00
Stan Lo
4e82346756 Update config.force_ssl's documentation 2016-02-25 13:41:09 +08:00
Prathamesh Sonpatki
4e92fb2097 Update documentation and deprecation message 2016-02-25 10:37:08 +05:30
Prathamesh Sonpatki
ddcb3eaf87 Add CHANGELOG entry 2016-02-25 10:28:44 +05:30
Prathamesh Sonpatki
31cf0f5571 Added deprecation for older apps
- For old apps which are not setting any value for hsts[:subdomains],
  a deprecation warning will be shown saying that hsts[:subdomains] will
  be turned on by default in Rails 5.1. Currently it will be set to
  false for backward compatibility.
- Adjusted tests to reflect this change.
2016-02-25 10:18:53 +05:30
Prathamesh Sonpatki
9ea8de334e Old applications will not get the ssl_options initializer
- We will remove the initializer for old apps which are migrated to
  Rails 5 so that they are not affected by this breaking change.
2016-02-25 09:43:33 +05:30
Prathamesh Sonpatki
00c4ecf38c New applications will be generated with ssl_options to enable HSTS with subdomains
- We will reuse config.ssl_options for setting the HSTS settings.
2016-02-25 09:42:30 +05:30
Egor Homakov
6eb3a1b058 HSTS without IncludeSubdomains is often useless
1) Because if you forget to add Secure; to the session cookie, it will leak to http:// subdomain in some cases
2) Because http:// subdomain can Cookie Bomb/cookie force main domain or be used for phishing.

That's why *by default* it must include subdomains as it's much more common scenario. Very few websites *intend* to leave their blog.app.com working over http:// while having everything else encrypted. 

Yes, many developers forget to add subdomains=true by default, believe me :)
2016-02-25 09:08:44 +05:30
Matthew Draper
50e4433b05 Merge pull request #23843 from maclover7/fix-23471
Only hijack Rack socket when first needed
2016-02-25 13:58:31 +10:30
Jon Moss
9e30869c9a Merge pull request #23863 from delftswa2016/fix-readme-heading
Fix README heading according to Markdown conventions
2016-02-24 21:50:14 -05:00
Jon Moss
a536cc8f1e Only hijack Rack socket when first needed
Fixes #23471
2016-02-24 21:48:59 -05:00
Aaron Ang
5bd179787f Fix title of README according to Markdown conventions
The first heading in some README's are indicated using a second level
heading (`##`), which in my opinion is of incorrect structure.
Therefore, in this patch I changed the first heading to a first level
heading (`#`) in README's where this incorrect structure occurs.

[ci skip]
2016-02-25 03:39:02 +01:00
Matthew Draper
d81a9d79ac Merge pull request #23488 from maclover7/actioncable-defaults
Enable ActionCable routes by default
2016-02-25 12:44:02 +10:30
Jon Moss
1afd414488 Only open Action Cable connection if data is being sent 2016-02-24 20:37:52 -05:00
Jon Moss
8b69f1eeba Enable Action Cable routes by default
This also marks Action Cable routes as internal to Rails.
2016-02-24 19:05:03 -05:00
Rafael França
8db771bb69 Merge pull request #23862 from prathamesh-sonpatki/test-for-strong-etag
Added a test for generating Strong ETag
2016-02-24 20:40:34 -03:00
Jon Moss
b5431d7843 Merge pull request #23870 from akshaymohite/api-app-debug-exception-response-format-in-doc
[ci skip] Need to mention debug_exception_response_format in the api_app documentation.
2016-02-24 18:37:59 -05:00
Akshay
afea912a75 [ci skip] Need to mention debug_exception_response_format in the api_app documentation.
- #23771 removed the reference to debug_exception_response_format from the api_app documentation.
- We need to let users know, they have ability to configure debug_exception_response_format in their development environment.
- Added documentation for the same in api_app.md file
- Grammar corrections
2016-02-25 05:03:21 +05:30
Jay Hayes
bbe59375d0 Update changelog 2016-02-24 17:22:26 -06:00
Jay Hayes
3ecab07800 Ensure server broadcasts are to string queue names
Similar to the channel streaming side, these values must be strings for
ActionCable to behave as expected. The conversion will allow users to
send string-convertible values and get the expected behavior.
2016-02-24 17:22:06 -06:00
yuuji.yaginuma
9614f9317f correctly check ApplicationRecord is exist in moutable engine
Follow up to 1813b29fc7632959800252f36e4b2e6ed4ac7266
2016-02-25 07:48:11 +09:00
Jon Moss
c889942368 Merge pull request #23866 from abhishekjain16/document
[ci skip] Replace usage of rake routes with rails routes
2016-02-24 16:54:31 -05:00
eileencodes
73f8c16601 Ensure suppressor runs before validations
I ran into an issue where validations on a suppressed record were
causing validation errors to be thrown on a record that was never going
to be saved.

There isn't a reason to run the validations on a record that doesn't
matter.

This change moves the suppressor up the chain to be run on the `save` or
`save!` in the validations rather than in persistence. The issue with
running it when we hit persistence is that the validations are run
first, then we hit persistance, and then we hit the suppressor. The
suppressor comes first.

The change to the test was required since I added the
`validates_presence_of` validations. Adding this alone was enough to
demonstrate the issue. I added a new test to demonstrate the new
behavior is explict.
2016-02-24 14:33:22 -05:00
Abhishek Jain
a39e195aef [ci skip] Replace usage of rake routes with rails routes 2016-02-25 01:00:30 +05:30
Aaron Patterson
a5776ed2b2 Merge branch 'master' into treewip
* master: (113 commits)
  remove useless method
  Updated file documentation [ci skip]
  changes caching guide to add note on weak etags
  Don't put config.action_mailer.perform_caching entry twice in development.rb
  Fix wording and wrong reference
  Add Ruby formatting to CHANGELOG entry
  Fix ActionView's cache section reference
  Do not define methods in the included block
  Add caching guide in ActionMailer basics
  Add ActionMailer configuration options
  Preparing for 5.0.0.beta3 release
  Update 5.0 release notes
  Enable tmp_restart plugin for puma
  Prep release for Rails 5 beta3
  [ci skip] Move collection caching changelog entry.
  Ensure `drop_table` even if tests failure or interrupted
  💣 run the test @rafaelfranca 😠
  Remove changelog entry for reverted commit
  Add CHANGELOG for https://github.com/rails/rails/pull/23734 [ci skip]
  No need CHANGELOG entry for #23849.
  ...
2016-02-24 11:29:16 -08:00
Aaron Patterson
f6fecabc0c remove useless method 2016-02-24 10:47:14 -08:00
Jay Hayes
046e32656e Convert stream broadcasting to a string
ActionCable does some things behind the scenes that expects these
"broadcasting"s or "channel"s to be strings. However it's not
immediately obvious that the value must be a string. So adding this
conversion ensures things work as expected.
2016-02-24 12:43:23 -06:00
Jay Hayes
b426247250 whitespace 2016-02-24 12:42:55 -06:00
प्रथमेश Sonpatki
3254dd0ffb Merge pull request #23861 from chashmeetsingh/patch-1
Updated file documentation [ci skip]
2016-02-24 23:17:18 +05:30
Prathamesh Sonpatki
641bb39bb2 Added a test for generating Strong ETag 2016-02-24 23:16:43 +05:30
Chashmeet Singh
861b98def8 Updated file documentation [ci skip] 2016-02-24 23:13:43 +05:30
Rafael França
edbab4e4f5 Merge pull request #23860 from zerothabhishek/weak-etag-guide
Changes caching guide to add note on weak etags
2016-02-24 14:23:41 -03:00
Abhishek Yadav
a6f8526ee6 changes caching guide to add note on weak etags 2016-02-24 22:48:28 +05:30
Rafael França
42270189b7 Merge pull request #23859 from prathamesh-sonpatki/dont-put-perform-caching-config-twice
Don't put config.action_mailer.perform_caching entry twice in development.rb
2016-02-24 14:11:16 -03:00
Prathamesh Sonpatki
263d63c15d Don't put config.action_mailer.perform_caching entry twice in development.rb 2016-02-24 22:35:15 +05:30
Rafael França
38b2f527d0 Merge pull request #23857 from st0012/update-documents
[ci skip] Update guide sources for mailer view caching feature
2016-02-24 14:00:20 -03:00
Claudio B
280c6714a9 Merge pull request #23858 from claudiob/fix-aca-readme
Add Ruby formatting to CHANGELOG entry
2016-02-24 08:53:57 -08:00
Stan Lo
5a2d7a1967 Fix wording and wrong reference 2016-02-25 00:53:38 +08:00
claudiob
7d46371d89 Add Ruby formatting to CHANGELOG entry
[ci skip]
2016-02-24 08:49:33 -08:00
Stan Lo
569cb157e7 Fix ActionView's cache section reference 2016-02-25 00:39:04 +08:00
Rafael Mendonça França
116581be91 Do not define methods in the included block
Instance methods can be defined in the module itself
2016-02-24 13:37:32 -03:00
Stan Lo
f7ce370e60 Add caching guide in ActionMailer basics 2016-02-25 00:36:41 +08:00
Stan Lo
bebd9086c8 Add ActionMailer configuration options 2016-02-25 00:17:05 +08:00
eileencodes
dbfa8fdfc2 Preparing for 5.0.0.beta3 release
Adds changelog headers for beta3 release
2016-02-24 11:14:40 -05:00