Commit Graph

9900 Commits

Author SHA1 Message Date
Prathamesh Sonpatki 199e277228 Updated request_forgery_protection docs [ci skip]
- Changed Javascript to JavaScript.
 - Added full-stop which was missing, also wrapped the sentence to 80 chars.
 - Changed proc to Proc and oauth to OAuth.
2015-04-28 09:52:53 +05:30
Arthur Nogueira Neves 86929c00c0 Merge pull request #18392 from brainopia/fix_route_requirements
Correct route requirements by overriding defaultls
2015-04-27 09:15:22 -04:00
Arthur Neves 757a2bc3e3
Don't reference sprockets assets on action pack
We need to ignore the `assets_prefix` when running a command like `rake
routes`. However we cannot reference asserts_prefix from action_pack as
that is a sprockets-rails concern.
See this is now implemented on sprockets-rails
85b89c44ad
2015-04-26 11:25:33 -04:00
Guo Xiang Tan 14d7e058a0 No need to capitalize verbs. [CI SKIP] 2015-04-26 00:18:56 +08:00
Rafael Mendonça França 4128e70791 Add nodoc to some private constants [ci skip] 2015-04-23 14:57:30 -03:00
Rafael Mendonça França d949460f9b Merge pull request #19823 from sbhatore/doc_fix_1
[ci skip] Description inside Signed and Encrypted CookieJars added
2015-04-23 14:40:40 -03:00
Siddharth Bhatore f92f5b706b Squashed commit of the following:
commit a88875ac6abaa4d8116b42af8cd71189ce3d44d3
Author: Siddharth Bhatore <sbhatore95@gmail.com>
Date:   Thu Apr 23 12:26:08 2015 +0530

    [ci skip] Update doc fix cookies

commit f175eaa7a21db898fc6c66334f770831028f9d00
Author: Siddharth Bhatore <sbhatore95@gmail.com>
Date:   Mon Apr 20 12:58:04 2015 +0530

    Description inside Signed and Encrypted CookieJars added
2015-04-23 22:56:56 +05:30
Nick Cox 4c4fa41b37 [ci skip] Add, clean up docs in ActionDispatch ActionDispatch middleware 2015-04-22 21:06:08 -07:00
Siddharth Bhatore 8f131a9ed5 [ci skip] UpgradeLegacySignedCookieJar Doc fix 2015-04-22 13:39:38 +05:30
Prem Sichanugrist 3a20e83795 Add missing require for String#strip_heredoc
This method is being used in `#xml_http_request`, but was not properly
required. This causes `NoMethodError` on projects that are doing
integration test.
2015-04-17 15:21:18 -04:00
yuuji.yaginuma 653246f3e5 remove extra `=` in form builder example [ci skip] 2015-04-15 23:06:01 +09:00
Arthur Nogueira Neves 7d4a1ab9ee Merge pull request #19757 from Strech/http-auth-realm-unquoting
Tiny optimization of http auth Realm unquoting
2015-04-14 17:00:32 -04:00
Rafael Mendonça França b4a9c59a47 Fix typos in the documentation [ci skip] 2015-04-14 12:56:43 -04:00
Rafael Mendonça França 9ec54d9500 Merge pull request #19736 from kmcphillips/master
Set default form builder for a controller
2015-04-14 11:23:49 -04:00
Strech (Sergey Fedorov) 53dedfcde9 Tiny optimization of http auth Realm unquoting 2015-04-14 19:56:07 +05:00
Kevin McPhillips 2b8acdcd21 Override default form builder for a controller 2015-04-13 23:43:34 -04:00
Zachary Scott 2778ba8ed5 Add note regarding CSRF for APIs, as a use-case for skipping it [ci skip] 2015-04-12 21:58:40 -07:00
Zachary Scott e1ebf146b5 Apply comments from @jeremy regarding why HTML and Javascript requests
specifically are checked for CSRF, when dealing with the browser.

[ci skip]
2015-04-12 21:56:01 -07:00
Vladimir Lyzo fd0f27ce79 update request_forgery_protection docs [ci skip] 2015-04-12 21:48:34 -07:00
Santiago Pastorino e085a7ddb8 Revert "Merge pull request #19682 from supercaracal/fix_force_ssl_redirection_flash_error"
This reverts commit d215620340, reversing
changes made to bbbbfe1ac0.
2015-04-12 22:26:35 -03:00
Toshi MARUYAMA 7e50492709 [Rails4 regression] prevent thin and puma cause error in Non ASCII URL on Windows
* https://github.com/rails/rails/issues/19187
* https://github.com/rails/rails/pull/19533
* https://github.com/macournoyer/thin/issues/268

These are serious Rails 4 regression for Redmine Bitnami Windows users.

https://community.bitnami.com/t/problems-with-3-0-1-installation-see-report-inside/30195/

It is not caused on webrick users.

Related:

* https://github.com/rack/rack/issues/732#issuecomment-67677272
* https://github.com/phusion/passenger/issues/1328
2015-04-09 19:25:12 -03:00
Taishi Kasuga 242c5c7ae4 fix fails to force_ssl_redirection if session_store is disabled 2015-04-09 11:21:00 +09:00
Rafael Mendonça França 8c8e9b34d5 Merge pull request #19700 from tancnle/trivial-shallow-nesting-depth-count
A shorter and more concise version of select..size
2015-04-08 20:08:06 -03:00
Tan Le 8d605b8ee8 A shorter and more concise version of select..size 2015-04-09 09:05:05 +10:00
Rafael Mendonça França 041c2c879a Merge pull request #19633 from y00rb/sort_router_parameters_duplicated_keys
avoid error when sort mixture keys in symbol and string
2015-04-08 19:01:11 -03:00
Yang Bo a77de09812 sort_by instead of sort
it is avoid sort errot within different and mixed keys.
used `sort_by` + `block` to list parameter by keys.
keep minimum changes
2015-04-08 22:18:56 +08:00
Bruce Park 164be37da5 remove new line between doc and method 2015-04-07 05:02:22 +00:00
Bruce Park 85eacc64a6 added docs for ActionDispatch::Request::Session#create 2015-04-07 01:23:51 +00:00
Rafael Mendonça França 8b88df94eb Merge pull request #19029 from iainbeeston/skipping-undefined-callbacks
Raise ArgumentError if an unrecognised callback is skipped
2015-04-06 19:07:21 -03:00
Santiago Pastorino 2c16acde0d Merge pull request #19666 from mikej/master
fix missing "if" in API docs for ActionController::Parameters#permit
2015-04-06 10:47:48 -03:00
eileencodes 188934cdac Fix ActionPack tests after changes to missing template logger
After merging #19377 ActionPack tests were missing a require for
`ActiveSupport::LogSubscriber::TestHelper` and change didn't take
into account that logger could be nil. Added the require and only log to
info if logger exists.

This wasn't caught earlier because these tests only run after a merge.
2015-04-06 09:03:13 -04:00
Eileen M. Uchitelle 6b98fbacf7 Merge pull request #19665 from eileencodes/fix-parse_query-method-signature
Fix method signature of `parse_query` to match rack
2015-04-06 08:34:20 -04:00
eileencodes 0eef12c0b3 Fix method signature of `parse_query` to match rack
Recently rack was changed to have a second argument on the `parse_query`
method (in rack/rack#781). Rails relies on this and it's `parse_query`
method was complaining about missing the second argument. I changed the
arguments to `*` so we don't have this issue in the future.
2015-04-06 08:30:32 -04:00
Michael Josephson e39f11f50a fix missing "if" in API docs for ActionController::Parameters#permit 2015-04-06 13:22:07 +01:00
Stephen Bussey 0de4a23d1c head no_content when there is no template or action performed 2015-04-05 15:46:50 -04:00
Robin Dupret 9cc41c36f7 Fix a few typos [ci skip] 2015-04-05 15:58:43 +02:00
Iain Beeston d2876141d0 Raise ArgumentError if an unrecognised callback is skipped
At present, if you skip a callback that hasn't been defined,
activesupport callbacks silently does nothing. However, it's easy to
mistype the name of a callback and mistakenly think that it's being
skipped, when it is not.

This problem even exists in the current test suite.
CallbacksTest::SkipCallbacksTest#test_skip_person attempts to skip
callbacks that were never set up.

This PR changes `skip_callback` to raise an `ArgumentError` if the
specified callback cannot be found.
2015-04-03 09:37:19 +01:00
brainopia 58d75fd811 Freeze static arguments for gsub 2015-04-02 02:15:07 +03:00
brainopia cdac52e124 Prefer string patterns for gsub
https://github.com/ruby/ruby/pull/579 - there is a new optimization
since ruby 2.2

Previously regexp patterns were faster (since a string was converted to
regexp underneath anyway). But now string patterns are faster and
better reflect the purpose.

  Benchmark.ips do |bm|
    bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') }
    bm.report('string') { 'this is ::a random string'.gsub('::', '/') }
    bm.compare!
  end
  # string: 753724.4 i/s
  # regexp: 501443.1 i/s - 1.50x slower
2015-04-02 02:07:45 +03:00
Xavier Noria 8798788c65 Merge pull request #19544 from shuhei/fix-parameters-const-missing
Return super in ActionController::Parameters.const_missing
2015-03-28 10:01:25 +01:00
Shuhei Kagawa 1b0526eaac Return super in ActionController::Parameters.const_missing
The current implementation of ActionController::Parameters.const_missing
returns `ActionController::Parameters.always_permitted_parameters` even
if its `super` returns a constant without raising error. This prevents its
subclass in a autoloading module/class from taking advantage of
autoloading constants.

    class SomeParameters < ActionController::Parameters
      def do_something
        DefinedSomewhere.do_something
      end
    end

In the code above, `DefinedSomewhere` is to be autoloaded with
`Module.const_missing` but `ActionController::Parameters.const_missing`
returns `always_permitted_parameters` instead of the autoloaded
constant.

This pull request fixes the issue respecting `const_missing`'s `super`.
2015-03-28 10:40:58 +09:00
George Claghorn c64b99ecc9 Add ActiveSupport::ArrayInquirer and Array#inquiry
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
string-like contents. For example, `request.variant` returns an `ArrayInquirer`
object. To check a request's variants, you can call:

    request.variant.phone?
    request.variant.any?(:phone, :tablet)

...instead of:

    request.variant.include?(:phone)
    request.variant.any? { |v| v.in?([:phone, :tablet]) }

`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`:

    pets = [:cat, :dog]
    pets.cat?    # => true
    pets.ferret? # => false
    pets.any?(:cat, :ferret} # => true
2015-03-24 13:33:01 -05:00
George Claghorn 9d9cc4777b Provide friendlier access to request variants
Closes #18933.
2015-03-24 12:49:27 -05:00
Ryan Tomayko 0b81b3094a Fix ActionDispatch::PublicExceptions returning string rack status
The status returned in the rack [status, headers, body] array was
a string, which can cause problems with middleware that assumes the
status will be a Fixnum. This likely never surfaced because other
middleware to_i the status returned from downstream apps before
passing it on.
2015-03-23 13:15:59 +00:00
adam b49cac80de Fix handling of empty X_FORWARDED_HOST header.
Previously, an empty X_FORWARDED_HOST header would cause
Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
Actiondispatch::Http:URL.host to raise a NoMethodError.
2015-03-20 20:32:30 +00:00
Boris Peterbarg 4be3997c9f Compare content_type with Mime::XML instead of regexp
Regexp is broken for both content types including charsets and for
integration tests, where the content_type is a Mime::Type and not String
2015-03-16 06:35:00 +02:00
Rafael Mendonça França cf5ec92a8b Merge pull request #19291 from hired/return-truthy-value-from-head
Return truthy value from head method
2015-03-13 11:06:20 -03:00
Joel Hayhurst d5efb1f9bd Return true from head method
It was returning false in normal circumstances.
This broke the `head :ok and return if` construct.
Add appropriate test.
2015-03-12 14:39:22 -07:00
Guillermo Iguaran ccf8678cec Merge pull request #19309 from f1sherman/dont-set-session-options-id
Use request.session.id instead of request.session_options[:id]
2015-03-12 11:30:12 -05:00
Brian John 82402e6583 Use request.session.id instead of request.session_options[:id]
As of the upgrade to Rack 1.5, request.session_options[:id] is no
longer populated. Reflect this change in the tests by using
request.session.id instead.

Related change in Rack:
https://github.com/rack/rack/commit/83a270d6
2015-03-12 09:52:38 -05:00