Commit Graph

12929 Commits

Author SHA1 Message Date
Akira Matsuda
dbf67b3a6f Unneeded &block parameters 2016-01-12 05:15:56 +09:00
Kasper Timm Hansen
56c93bba2f Merge pull request #21181 from denisenkom/mypatch
Test basic auth with symbols in password
2016-01-10 17:44:43 +01:00
Akshay Vishnoi
ab40d71ff8 [ci skip] Fix typo Renderering --> Rendering 2016-01-09 05:28:44 +05:30
Prathamesh Sonpatki
4824971f36 Fix typo in ActionPack CHANGELOG [ci skip] 2016-01-08 08:31:08 +05:30
Ben Toews
77d01e36aa add greg 2016-01-07 12:35:46 -07:00
Edouard CHIN
ce13f79105 Better error message when running rake routes with CONTROLLER arg:
- `CONTROLLER` argument can now be supplied in different ways (Rails::WelcomeController, Rails::Welcome, rails/welcome)
- If `CONTROLLER` argument was supplied but it does not exist, will warn the user that this controller does not exist
- If `CONTROLLER` argument was supplied and no routes could be found matching this filter, will warn the user that no routes were found matching the supplied filter
- If no routes were defined in the config/routes.rb file, will warn the user with the original message
2016-01-07 06:35:40 -05:00
Kasper Timm Hansen
c02b85614c Merge pull request #20109 from prathamesh-sonpatki/keep-only-one-root
Remove original root method from Base module and kept overridden implementation in Resources module.
2016-01-07 12:03:22 +01:00
Prathamesh Sonpatki
ee1534e5ab Kept overridden root method and removed original method
- The root method is defined and documented in Base module and
   decorated in Resources module.
 - The documentation in Base module actually talks about method
   signature of decorated method from Resources module.
 - Argument handling was moved to decorated method in
   977455cc2e
   to handle options such as :as with directly passed path parameter.
 - To avoid the confusion, removed original root method from Base module
   and only kept overridden version in Resources module.

 - References - https://github.com/rails/rails/pull/12208 &
                https://github.com/rails/rails/pull/12208#issuecomment-24350897.
2016-01-07 15:50:24 +05:30
Prathamesh Sonpatki
70e73e4d4c Remove splat operator warning from ssl_test
- Removes following warning -

  `rails/actionpack/test/dispatch/ssl_test.rb:203: warning: `*' interpreted as argument prefix`.
2016-01-07 13:53:10 +05:30
Prathamesh Sonpatki
a31078556a Allow AC::Parameters as an argument to url_helpers
- Earlier only Hash was allowed as params argument to url_helpers.
- Now ActionController::Parameters instances will also be allowed.
- If the params are not secured then it will raise an ArgumentError to
  indicate that constructing URLs with non-secure params is not recommended.
- Fixes #22832.
2016-01-07 12:12:34 +05:30
Rafael França
ced9612b59 Merge pull request #22275 from mastahyeti/per-form-csrf
Per-form CSRF tokens
2016-01-06 02:55:10 -02:00
Rafael França
8788c7ce84 Merge pull request #22906 from bf4/rendering_exceptions
Add ActionController:Renderers test
2016-01-04 21:12:11 -02:00
Ben Toews
3e98819e20 add option for per-form CSRF tokens 2016-01-04 12:26:38 -07:00
Benjamin Fleischer
f2b3b4019a Group related methods together 2016-01-03 22:54:42 -06:00
Benjamin Fleischer
f27360af04 Add ActionController:Renderers test
To complement actionpack/test/controller/metal/renderers_test.rb
2016-01-03 22:51:45 -06:00
Santiago Pastorino
3d590add45 Merge pull request #22890 from DNNX/times-map
Replace x.times.map{} with Array.new(x){} in AD::Journey::Path::Pattern
2016-01-03 20:23:50 -03:00
Anton Davydov
7d74b73a06 Fix typo in test desctiption [skip ci] 2016-01-04 00:11:03 +03:00
Viktar Basharymau
20aef99f7b Replace x.times.map{} with Array.new(x){}
The former is slightly more readable, performant and has fewer method calls.

```ruby
Benchmark.ips do |x|
  x.report('times.map') { 5.times.map{} }
  x.report('Array.new') { Array.new(5){} }
  x.compare!
end
__END__
Calculating -------------------------------------
           times.map    21.188k i/100ms
           Array.new    30.449k i/100ms
-------------------------------------------------
           times.map    311.613k (± 3.5%) i/s -      1.568M
           Array.new    590.374k (± 1.2%) i/s -      2.954M

Comparison:
           Array.new:   590373.6 i/s
           times.map:   311612.8 i/s - 1.89x slower
```
2016-01-02 19:34:40 +03:00
Rafael França
8167fa4562 Merge pull request #22519 from bf4/test_use_renderers
Add tests for ActionController::Renderers::use_renderers
2015-12-31 20:17:00 -02:00
Benjamin Fleischer
1c361ea356 Test ActionController::Renderers::use_renderers 2015-12-31 13:07:58 -06:00
Rashmi Yadav
1b608a695c Update copyright notices to 2016 [ci skip] 2015-12-31 18:27:19 +02:00
Kasper Timm Hansen
4ff5f6a15b Merge pull request #22850 from prathamesh-sonpatki/fix_ac_params_unsafe_h_2
Fix AC::Parameters#to_unsafe_h to return all unfiltered values
2015-12-31 09:04:42 +01:00
Prathamesh Sonpatki
28f648dbc7 Fix AC::Parameters#to_unsafe_h to return all unfiltered values
- AC::Parameters#convert_parameters_to_hashes should return filtered or
  unfiltered values based on whether it is called from `to_h` or `to_unsafe_h`
  instead of always defaulting to `to_h`.
- Fixes #22841
2015-12-31 12:32:29 +05:30
Rafael França
1f85e1c9f3 Merge pull request #22826 from timrogers/actiondispatch-ssl-config
Configurable redirect and secure cookies for ActionDispatch::SSL
2015-12-31 03:25:47 -02:00
Rafaël Blais Masson
040ed26656 Avoid Time.parse for static date
Benchmark.ips do |x|
    x.report('Time.parse') { Time.parse('2011-01-01') }
    x.report('Time.new')   { Time.new(2011, 1, 1) }
  end

  Calculating -------------------------------------
            Time.parse     6.640k i/100ms
              Time.new    15.082k i/100ms
  -------------------------------------------------
            Time.parse     71.915k (± 3.1%) i/s -    365.200k
              Time.new    167.645k (± 3.3%) i/s -    844.592k
2015-12-30 14:36:32 -05:00
Prathamesh Sonpatki
07af4dfd00 Fix test for AC::Parameters#to_unsafe_h
- Test should call `to_unsafe_h` instead of `to_h`
2015-12-30 20:54:46 +05:30
Richard Schneeman
cc5ae3e6df Merge pull request #22830 from jcoyne/parameters_include
Add AC::Parameters#include?
2015-12-29 14:14:51 -06:00
Jorge Bejar
44ca804229 Format from Accept headers have higher precedence than path extension format 2015-12-29 13:43:14 -03:00
Jorge Bejar
9a85da9367 Rely on default Mime format when MimeNegotiation#format_from_path_extension is not a valid type
Closes #22747
2015-12-29 13:42:57 -03:00
Justin Coyne
ff8a62d1d0 Add AC::Parameters#include?
Fixes #22818
2015-12-29 10:11:26 -06:00
Tim Rogers
32b1c90837 Flexible configuration for ActionDispatch::SSL 2015-12-29 13:07:51 +00:00
Tim Rogers
9e0fa4cddd Improve RDoc documentation of ActionDispatch::SSL 2015-12-24 14:11:51 +00:00
Rafael Mendonça França
d182c22e91 Currectly test the Middleware#== 2015-12-22 17:09:26 -02:00
Rafael Mendonça França
d9f4a2839f Merge pull request #22743 from maclover7/fix-22738
Add #== back to ActionDispatch::MiddlewareStack::Middleware
2015-12-22 15:04:53 -02:00
Yves Senn
099082690d release notes, extract notable changes from Action Pack CHANGELOG.
[ci skip]
2015-12-22 12:19:37 +01:00
Jon Moss
0c5287a668 Add #== back to ActionDispatch::MiddlewareStack::Middleware
This was causing bug #22738 to occur. Also added extra tests to make
sure everything is A-OK.
2015-12-21 19:55:10 -05:00
Matthew Draper
b7ac079068 Remember the parameter hash we return
Callers expect to be able to manipulate it.
2015-12-22 05:48:38 +10:30
Genadi Samokovarov
c5b6ec7b0f No more no changes entries in the CHANGELOGs
During the `5.0.0.beta1` release, the CHANGELOGs got an entry like the
following:

```
* No changes.
```

It is kinda confusing as there are indeed changes after it. Not a
biggie, just a small pass over the CHANGELOGs.

[ci skip]
2015-12-21 11:46:38 +02:00
Vijay Dev
b691d62be9 Merge branch 'master' of github.com:rails/docrails 2015-12-20 12:33:46 +00:00
eileencodes
099ddfdefd Add CHANGELOG headers for Rails 5.0.0.beta1 2015-12-18 15:58:25 -05:00
eileencodes
7eae0bb88e Change alpha to beta1 to prep for release of Rails 5
🎉 🍻
2015-12-18 12:14:09 -05:00
Rafael França
027d964d89 Merge pull request #22650 from derekprior/dp-actionpack-warnings
Fix "instance variable not initialized" in tests
2015-12-18 12:49:36 -02:00
Rafael França
b5c13fcdaa Merge pull request #20797 from byroot/prevent-url-for-ac-parameters
Prevent ActionController::Parameters in url_for
2015-12-18 12:47:38 -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
31ef17a5eb
Fix "instance variable not initialized" in tests
The ActionPack test suite had a handful of these warnings when run. This
was due to `assert_response` being tested outside the context of a
controller instance where those instance variables would already have
been initialized.
2015-12-17 21:20:25 -05:00
Derek Prior
91e3aa1942
Document when fallback_location is used [ci-skip]
If you're not familiar with how the `Referer` header works, you likely
won't understand why you need to provide a fallback or under what
circumstances it would be used.

Hopefully this clarifies things a bit.
2015-12-17 20:57:42 -05:00
Kasper Timm Hansen
4b46c5ce83 Only dup Ruby's Hash and Array.
When calling `to_h` on an `ActionController::Parameters` instance it would
`deep_dup` its internal parameters.

This inadvertently called `dup` on a passed Active Record model which would
create new models. Fix by only dupping Ruby's Arrays and Hashes.
2015-12-17 21:55:03 +01:00
Derek Prior
dc4429ca3b
Deprecate redirect_to :back
Applications that use `redirect_to :back` can be forced to 500 by
clients that do not send the HTTP `Referer` (sic) header.
`redirect_back` requires the user to consider this possibility up front
and avoids this trivially-caused application error.
2015-12-16 11:42:25 -05: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
Rafael França
d953512360 Merge pull request #22605 from tonyta/delete-dead-comments
Delete dead code comments
2015-12-16 14:23:31 -02:00