Commit Graph

540 Commits

Author SHA1 Message Date
Rafael Mendonça França
92e27d30d8 Remove deprecated assertion files 2015-01-04 11:58:42 -03:00
Rafael Mendonça França
34e380764e Remove deprecated usage of string keys in URL helpers 2015-01-04 11:58:42 -03:00
Rafael Mendonça França
e4e1fd7ade Remove deprecated only_path option on *_path helpers 2015-01-04 11:58:42 -03:00
Rafael Mendonça França
2cc91c37bc Remove deprecated NamedRouteCollection#helpers 2015-01-04 11:58:42 -03:00
Rafael Mendonça França
1f3b0a8609 Remove deprecated support to define routes with :to option that
doesn't contain `#`
2015-01-04 11:58:41 -03:00
Rafael Mendonça França
4b19d5b7bc Remove deprecated ActionDispatch::Response#to_ary 2015-01-04 11:58:41 -03:00
Rafael Mendonça França
7676659633 Remove deprecated ActionDispatch::Request#deep_munge 2015-01-04 11:58:41 -03:00
Rafael Mendonça França
7fe7973cd8 Remove deprecated ActionDispatch::Http::Parameters#symbolized_path_parameters 2015-01-04 11:58:41 -03:00
Rafael Mendonça França
e4cfd353a4 Remove deprecated option use_route in controller tests 2015-01-04 11:58:41 -03:00
Rafael Mendonça França
2d743b528c Merge pull request #17978 from kommen/fixed-pr-14903
Ensure append_info_to_payload is called even if an exception is raised.

Conflicts:
	actionpack/CHANGELOG.md
2015-01-02 14:16:15 -03:00
Robin Dupret
7ef7f1cc15 Correctly use the response's status code calling head
Commit 20fece1 introduced the `_status_code` method to fix calls to
`head :ok`. This method has been added on both ActionController::Metal
and ActionDispatch::Response.

As for the latter, this method is just equivalent to the `response_code`
one so commit aefec3c removed it from the `Reponse` object so call to
the `_status_code` method on an ActionController::Base instance would be
handled by the `Metal` class (which `Base` inherits from) but the status
code is not updated according to the response at this level.

The fix is to actually rely on `response_code` for ActionController::Base
instances but this method doesn't exist for bare Metal controllers so we
need to define it.
2014-12-31 16:37:35 +01:00
Prathamesh Sonpatki
75757c5c3b Remove single space response body for head request
- The single space response was added due to a bug in safari
  in cb0f8fda96
  and
  807df4fcf0.
- This was removed from the `render nothing: true` in
  https://github.com/rails/rails/pull/14883.
- Removing it from response of :head also. As :head is more obvious
  alternative to call `render nothing:
  true`(http://guides.rubyonrails.org/layouts_and_rendering.html#using-head-to-build-header-only-responses),
  removing it from head method also.
- Closes #18253.
2014-12-30 20:50:23 +05:30
Rafael Mendonça França
0c070ae568 Merge pull request #18251 from tjgrathwell/fix-polymorphic-routes-to-model
Fix form_for to work with objects that implement to_model
2014-12-30 11:23:47 -03:00
Yves Senn
0587070391 cleanup CHANGELOGs. [ci skip] 2014-12-23 08:56:17 +01:00
Chris Sinjakli
8f8ccb9901 Don't convert empty arrays to nils when deep munging params 2014-12-15 14:51:07 +00:00
Alex Robbin
a842c5c12d allow URL helpers to work with optional scopes 2014-12-13 15:52:41 -05:00
Tatiana Soukiassian
1a50be8231 Fix handling of positional url helper arguments when format is false
There is no need to subtract one from the path_params size when there is
no format parameter because it is not present in the path_params array.

Fixes #17819.
2014-12-13 15:42:15 +00:00
Dieter Komendera
2fde159f6b Ensure append_info_to_payload is called even if an exception is raised.
See:
* https://github.com/rails/rails/pull/14903
* https://github.com/roidrage/lograge/issues/37

Some code by mxrguspxrt from #14903.
2014-12-10 22:13:13 +01:00
Rafael Mendonça França
f25ad07f5a Start Rails 5 development 🎉
We will support only Ruby >= 2.1.

But right now we don't accept pull requests with syntax changes to drop
support to Ruby 1.9.
2014-11-28 15:00:06 -02:00
Matthew Draper
25b14b4d32 Merge pull request #17186 from tgxworld/header_authentication_token
Allow authentication header to not have to specify 'token=' key.
2014-11-27 01:44:13 +10:30
Sean Griffin
0bc04ced98 Changelog format 2014-11-24 19:18:33 -07:00
Melanie Gilman
4d84922840 Deprecate string options in URL helpers
Fixes https://github.com/rails/rails/issues/16958

[Byron Bischoff & Melanie Gilman]
2014-11-24 21:16:33 -05:00
Godfrey Chan
aa1fadd48f Deprecate the only_path option on *_path helpers.
In cases where this option is set to `true`, the option is redundant and can
be safely removed; otherwise, the corresponding `*_url` helper should be
used instead.

Fixes #17294.

See also #17363.

[Dan Olson, Godfrey Chan]
2014-10-28 09:43:33 -07:00
Yves Senn
400b0818fa some changelog formatting. [ci skip] 2014-10-16 09:11:41 +02:00
Nicolas Cavigneaux
3041bb2a94 Improve Journey compliance to RFC 3986
The scanner in Journey fails to recognize routes that use literals
from the sub-delims section of RFC 3986.

This commit enhance the compatibility of Journey with the RFC by
adding support of authorized delimiters to the scanner.

Fix #17212
2014-10-14 16:42:50 +02:00
Rafael Mendonça França
0863c9248f No need CHANGLOG entry for a bug in a non released version
[ci skip]
2014-09-25 17:21:55 -03:00
Gert Goet
2d08fd2506 Remove internal options from query string of paths
Fixes #17057
2014-09-25 17:50:16 +02:00
Jeremy Kemper
2a78d6f561 Deprecate implicit AD::Response splatting and Array conversion 2014-09-06 07:05:59 -07:00
Peter Suschlik
a59a9b7f72 Don't rescue IPAddr::InvalidAddressError
IPAddr::InvalidAddressError does not exist in Ruby 1.9.3
and fails for JRuby in 1.9 mode.

As IPAddr::InvalidAddressError is a subclass of ArgumentError
(via IPAddr::Error) just rescuing ArgumentError is fine.
2014-08-29 09:05:31 +02:00
Aaron Patterson
6d86762fd8 Merge pull request #16637 from Agis-/redirect-with-constraint-route
Fix the router ignoring constraints when used together with a redirect route
2014-08-28 10:33:40 -07:00
Yves Senn
20e7f08ecc minor changelog formatting changes. 2014-08-27 12:09:21 +02:00
Agis-
d78f3f0ec3 Don't ignore constraints in redirect routes
402c2af550
introduced a regression that caused any constraints added to redirect routes
to be ignored.

Fixes #16605
2014-08-25 00:18:25 +03:00
Sam Aarons
f9a84bb236 Refactor ActionDispatch::RemoteIp
Refactored IP address checking in ActionDispatch::RemoteIp to rely on
the IPAddr class instead of the unwieldly regular expression to match
IP addresses. This commit keeps the same api but allows users to pass
IPAddr objects to config.action_dispatch.trusted_proxies in addition
to passing strings and regular expressions.

Example:

    # config/environments/production.rb
    config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')
2014-08-21 18:38:08 -07:00
Guo Xiang Tan
d3eb92d95a Avoid duplicating routes for HEAD requests.
Follow up to rails#15321

Instead of duplicating the routes, we will first match the HEAD request to
HEAD routes. If no match is found, we will then map the HEAD request to
GET routes.
2014-08-21 16:35:39 +08:00
schneems
cfaaacd976 Enable gzip compression by default
If someone is using ActionDispatch::Static to serve assets and makes it past the `match?` then the file exists on disk and it will be served. This PR adds in logic that checks to see if the file being served is already compressed (via gzip) and on disk, if it is it will be served as long as the client can handle gzip encoding. If not, then a non gzip file will be served.

This additional logic slows down an individual asset request but should speed up the consumer experience as compressed files are served and production applications should be delivered with a CDN. This PR allows a CDN to cache a gzip file by setting the `Vary` header appropriately. In net this should speed up a production application that are using Rails as an origin for a CDN. Non-asset request speed is not affected in this PR.
2014-08-20 22:33:06 -05:00
Prem Sichanugrist
5109740c6b Make AC::Params#to_h return Hash with safe keys
`ActionController::Parameters#to_h` now returns a `Hash` with
unpermitted keys removed. This change is to reflect on a security
concern where some method performed on an `ActionController::Parameters`
may yield a `Hash` object which does not maintain `permitted?` status.
If you would like to get a `Hash` with all the keys intact, duplicate
and mark it as permitted before calling `#to_h`.

    params = ActionController::Parameters.new(name: 'Senjougahara Hitagi')
    params.to_h # => {}

    unsafe_params = params.dup.permit!
    unsafe_params.to_h # => {"name"=>"Senjougahara Hitagi"}

    safe_params = params.permit(:name)
    safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}

This change is consider a stopgap as we cannot chage the code to stop
`ActionController::Parameters` to inherit from
`HashWithIndifferentAccess` in the next minor release.

Also, adding a CHANGELOG entry to mention that
`ActionController::Parameters` will not inheriting from
`HashWithIndifferentAccess` in the next major version.
2014-08-18 20:42:45 -04:00
Rafael Mendonça França
9cb4d3e03b Deprecate TagAssertion instead of removing 2014-08-18 20:20:41 -03:00
Rafael Mendonça França
c78da4d5c4 Merge branch 'master' into loofah
Conflicts:
	actionpack/CHANGELOG.md
2014-08-17 22:38:22 -03:00
Godfrey Chan
e158ee50e6 Use AS::JSON for (de)serializing cookies
Use the Active Support JSON encoder for cookie jars using the `:json` or
`:hybrid` serializer. This allows you to serialize custom Ruby objects into
cookies by defining the `#as_json` hook on such objects.

Fixes #16520.
2014-08-17 12:41:42 -07:00
Godfrey Chan
beff925c32 Merge pull request #16467 from strzalek/cookies-digest-config-option2
Cookies digest config option (pt. 2)

Conflicts:
	actionpack/CHANGELOG.md
	actionpack/lib/action_dispatch/middleware/cookies.rb
2014-08-17 11:23:14 -07:00
Kasper Timm Hansen
1e2ffe7ae6 Prepare for partial release.
- Default to Rails::DeprecatedSanitizer in ActionView::Helpers::SanitizeHelper.
- Add upgrade notes.
- Add sanitizer to new applications Gemfiles.
- Remove 'rails-dom-testing' as a dependency.
2014-08-17 19:25:47 +02:00
José Valim
ee77770d57 Move respond_with to the responders gem
respond_with (and consequently the class-level respond_to)
are being removed from Rails. Instead of moving it to a 3rd
library, the functionality will be moved to responders gem
(at github.com/plataformatec/responders) which already provides
some responders extensions.
2014-08-17 13:20:22 -04:00
Jeremy Kemper
6c96602bc1 When your templates change, browser caches bust automatically.
New default: the template digest is automatically included in your ETags.
When you call `fresh_when @post`, the digest for `posts/show.html.erb`
is mixed in so future changes to the HTML will blow HTTP caches for you.
This makes it easy to HTTP-cache many more of your actions.

If you render a different template, you can now pass the `:template`
option to include its digest instead:

  fresh_when @post, template: 'widgets/show'

Pass `template: false` to skip the lookup. To turn this off entirely, set:

  config.action_controller.etag_with_template_digest = false
2014-08-17 06:52:17 -07:00
Yves Senn
a1ddde15ae remove deprecated MissingHelperError proxy.
The error was moved outside of the `ClassMethods` module.
2014-08-14 09:37:21 +02:00
Guo Xiang Tan
b1ba333ea7 Fix assert_template for files.
The test was not failing for `assert_template file: nil` when a file
has been rendered.
2014-08-14 00:03:32 +08:00
Łukasz Strzałkowski
29be3f5d83 Add config option for cookies digest
You can now configure custom digest for cookies in the same way as `serializer`:

  config.action_dispatch.cookies_digest = 'SHA256'
2014-08-12 21:57:51 +02:00
Rafael Mendonça França
a2400308ea Merge branch 'master' into loofah
Conflicts:
	actionpack/CHANGELOG.md
	actionpack/test/controller/integration_test.rb
	actionview/CHANGELOG.md
2014-08-12 11:10:42 -03:00
Santiago Pastorino
d70ba48c4d Revert "Merge pull request #16434 from strzalek/cookies-digest-config-option"
This reverts commit 705977620539e2be6548027042f33175ebdc2505, reversing
changes made to dde91e9bf5ab246f0f684b40288b272f4ba9a699.

IT BROKE THE BUILD!!!
2014-08-08 18:20:33 -03:00
Łukasz Strzałkowski
cfbedd3479 Add config option for cookies digest
You can now configure custom digest for cookies in the same way as `serializer`:

config.action_dispatch.cookies_digest = \SHA256'
2014-08-08 21:20:27 +02:00
Ryan Dao
28595e0128 Update actionpack CHANGELOG 2014-08-08 15:04:55 +07:00