Commit Graph

11830 Commits

Author SHA1 Message Date
Vijay Dev
4b9dba99d6 Merge branch 'master' of github.com:rails/docrails 2015-01-03 14:58:17 +00:00
Rafael Mendonça França
3456d543eb Merge pull request #10380 from JonRowe/test_all_domain_2_letter_tld
Assert that 2 letter tlds with 3 letter domain names work when option specified.
2015-01-02 21:27:38 -03:00
Rafael Mendonça França
48deeab90a Merge pull request #8740 from amatsuda/missing_source_file
replace use of MissingSourceFile with LoadError

Conflicts:
	activesupport/test/core_ext/load_error_test.rb
2015-01-02 19:19:59 -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
brainopia
95333e1317 Integration requests should work in contexts without setup and teardown 2015-01-02 16:52:32 +03:00
Robin Dupret
24637e577c Merge pull request #18271 from arunagw/change-copyright-year
Update copyright notices to 2015 [ci skip]
2015-01-01 00:08:17 +01: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
Arun Agrawal
4de18d0ead Update copyright notices to 2015 [ci skip] 2014-12-31 08:34:14 +01:00
Aaron Patterson
4080dd2f24 stop referencing env in url_for
encapsulate env in the request so that we can eventually move away from
the env hash
2014-12-30 15:18:20 -08:00
Aaron Patterson
87a7591064 use methods on the request rather than direct hash access
this will help decouple us from using the rack env hash
2014-12-30 14:48:10 -08: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
Travis Grathwell
3efd90ac5b Fix form_for to work with objects that implement to_model
Previously, if you tried to use form_for with a presenter object
that implements to_model, it would crash in
action_dispatch/routing/polymorphic_routes.rb when asking the presenter
whether it is .persisted?

Now, we always ask .persisted? of the to_model object instead.

This seems to been an issue since 1606fc9d840da869a60213bc889da6fcf1fdc431

Signed-off-by: Eugenia Dellapenna <eugenia.dellapenna@gmail.com>
2014-12-29 18:12:03 -08:00
Zachary Scott
241ccaef88 Move longer form example from integration guide to api reference, below an
existing example. [ci skip]

My reasoning is that this is probably too much information for the complete
Rails testing guide, as we're trying to cover testing all aspects of the
framework.
2014-12-29 17:29:47 -08:00
Robin Dupret
73fe108d70 Minor documentation edits [ci skip] 2014-12-28 22:55:09 +01:00
Guillermo Iguaran
edaab4dbe8 Merge pull request #18209 from claudiob/bump-to-2-2
Require Ruby 2.2 for Rails 5.0
2014-12-28 16:39:39 -05:00
Ben Prew
75df8b9a77 Update example test documentation
Example does not work with session headers, should use request headers. [ci skip]
2014-12-28 13:10:01 -08:00
claudiob
d3b098b828 Require Ruby 2.2 for Rails 5.0
Stems from [this comment](https://github.com/rails/rails/pull/18203#issuecomment-68138096) by @robin850
and by the blog post http://weblog.rubyonrails.org/2014/12/19/Rails-4-2-final
2014-12-26 13:53:09 +01:00
claudiob
4761d81923 Remove ActionController::ModelNaming
The methods in these modules are not used anywhere. They used to be
invoked in polymorphic_routes.rb but their usage was removed in e821045.

What is your opinion about removing these methods?

They do belong to the public API, but in reality their code has already been duplicated to ActionView::ModelNaming, since they are used by methods like `dom_id` and `dom_class` to associated records with DOM elements (in
ActionView).

Please tell me if you think that removing this module is a good idea and,
in that case, if the PR is okay as it is, or you'd rather start by showing
a deprecation message, and remove the module in Rails 5.1.
2014-12-25 00:30:46 +01:00
Vipul A M
7b2728cac1 - Removed unused parameter to cookie serialize method and fixed usage of the same elsewhere 2014-12-24 18:45:55 +05:30
Yves Senn
0587070391 cleanup CHANGELOGs. [ci skip] 2014-12-23 08:56:17 +01:00
claudiob
bea61d6670 Better docs for AbstractController
Fixes internal links, adds examples and set fixed-width fonts.

[ci skip]
2014-12-22 03:53:48 +01:00
Vijay Dev
15590c1a2a Merge branch 'master' of github.com:rails/docrails 2014-12-20 14:26:21 +00:00
Arthur Nogueira Neves
e4f015e4e8
Merge pull request #18102 from arthurnn/nodoc_constant
Add nodoc to some constants [skip ci]
2014-12-19 18:22:46 -05:00
Godfrey Chan
111f2f4422 Use released rack
`rack.version` was bumped in 28e77c710a
2014-12-19 01:26:19 -08:00
Godfrey Chan
5923ee6fe0 Revert "Merge pull request #18003 from sikachu/permit_all_parameters-thread-safety"
This reverts commit da5cc10e945552da54234f858470238a3fc36767.

Fixes #18091

See also https://github.com/rails/rails/pull/18003#commitcomment-9030909
2014-12-19 01:14:26 -08:00
claudiob
78ae8eebe5 Add docs for ActionDispatch::Http::URL methods
Add docs for `extract_domain`, `extract_subdomains`, `extract_subdomain`.

Add doc examples for `url`, `protocol`, `raw_host_with_port`, `host`,
`host_with_port`, `port`, `standard_port`, `standard_port?`, `optional_port`,
`port_string`.

[ci skip]
2014-12-18 15:31:45 -08:00
Zachary Scott
3f6a472d92 Fix typo in nodoc should be :nodoc: for RDoc to parse correctly 2014-12-17 17:03:29 -08:00
Rafael Mendonça França
e745ae297f Merge pull request #17995 from jethroo/fix/assert_template_with_unsupported_layout_type
assert template should raise ArgumentError for unsupported layout types
2014-12-16 18:35:38 -02:00
Carsten Wirth
7ff31feb14 adding that assert_template with :layout will raise ArgumentError for unknown layout type 2014-12-16 19:30:52 +01:00
Rafael Mendonça França
3bdd110dfe Merge pull request #18052 from timoschilling/reset_variants
allow reseting of request variants
2014-12-16 15:06:01 -02:00
Timo Schilling
e1fb3483d6 allow reseting of request variants
The current implementation of `variants=` don't allow a resetting to nil, wich is the default value.

This results in the following code smell:
```ruby
case request.user_agent
when /iPhone/
  request.variants = :phone
when /iPad/
  request.variants = :ipad
end
```

With the ability to reset variants to nil, it could be:
```ruby
request.variants = case request.user_agent
when /iPhone/
  :phone
when /iPad/
  :ipad
end
```
2014-12-16 11:37:04 +01:00
claudiob
8dfa585db2 Remove misleading test: around_action return false
When an `around_action` does not `yield`, then the corresponding action is
*never* executed and the `after_` actions are *never* invoked.

The value returned by the `around_action` does not have any impact on this:
an `around_action` can "return" `true`, `false`, or `"pizza"`, but as long
as `yield` is not invoked, the corresponding action and after callbacks are
not executed.

The test suite for `ActionController::Callbacks` currently includes separate
tests to distinguish the cases in which a non-yielding `around_actions` returns
`true` or `false`.

In my opinion, having such tests is misleading, giving the impression that the
returned value might have some sort of impact, while it does not. At least
that's the impression I got when I read those tests.

For completeness, the tests were introduced 7 years ago by @NZKoz in e80fabb.
2014-12-15 16:36:50 -08:00
Chris Sinjakli
8f8ccb9901 Don't convert empty arrays to nils when deep munging params 2014-12-15 14:51:07 +00:00
Santiago Pastorino
ef99d4cd3e Merge pull request #18022 from agrobbin/url-helpers-optional-scopes
Allow URL helpers to work with optional scopes
2014-12-13 19:03:30 -02:00
Alex Robbin
a842c5c12d allow URL helpers to work with optional scopes 2014-12-13 15:52:41 -05:00
Nate Berkopec
d57d85a126 ParameterFilter shouldn't try to dup symbol keys 2014-12-13 15:34:59 -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
Rafael Mendonça França
b64d89482a Merge pull request #18006 from sikachu/add-params-to_unsafe_h
Add AC::Parameters#to_unsafe_h
2014-12-12 23:58:46 -02:00
Prem Sichanugrist
61fff0e23b Add AC::Parameters#to_unsafe_h
As suggested in #16299([1]), this method should be a new public API for
retrieving unfiltered parameters from `ActionController::Parameters`
object, given that `Parameters#to_hash` will no longer work in Rails
5.0+ as we stop inheriting `Parameters` from `Hash`.

[1]: https://github.com/rails/rails/pull/16299#issuecomment-50220919
2014-12-12 18:52:10 +07:00
Prem Sichanugrist
0d975e289d Make AC::Params.permit_all_parameters thread safe
As discussed in #16299[1], this attribute is not thread safe and could
potentially create a security issue.

[1]: https://github.com/rails/rails/pull/16299#discussion_r15424533
2014-12-12 17:30:05 +07: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
d428242c86 Only check that it is a Rails application once
Also avoid using try since is_a? is faster for this case.
2014-12-08 15:42:55 -02:00
T.J. Schuck
ee65f48c26 Mounted Rack apps should have default named routes based on app name
This fixes a regression in 4.2.0 from 4.1.8.

https://github.com/rails/rails/pull/17823 fixed a similar regression regarding _explicitly_ named routes for a mounted Rack app, but there was another regression for the default value.

With a route like:

    Rails.application.routes.draw do
      mount Mountable::Web, at: 'some_route'
    end

The "Prefix" column of rake routes gives the following:

- 4.1.8:         mountable_web
- 4.2.0.beta1-4: [nothing]
- 4.2.0.rc1:     [nothing]
- 4.2.0.rc2:     some_route   <- regression

This fixes the default to go back to being based off the name of the class like the docs specify: 785d04e310/actionpack/lib/action_dispatch/routing/mapper.rb (L558-L560)

Explicitly named routes still work correctly per https://github.com/rails/rails/pull/17823:

    Rails.application.routes.draw do
      mount Mountable::Web, at: 'some_route', as: 'named'
    end

- 4.1.8:         named
- 4.2.0.beta1-4: [nothing]
- 4.2.0.rc1:     [nothing]
- 4.2.0.rc2:     named
2014-12-06 01:17:50 -05:00
Sergey Alekseev
198b1dd201 remove unused #optional_parts
This method was copied from journey at 56fee39c39 (diff-2cfaf53c860732fea8689d6f2002594bR78).
`grep -nr 'optional_parts' .`
2014-12-05 16:21:17 +03:00
Sergey Alekseev
db00c5b7a4 remove unused #generalized_table
This method wass copied from journey at 56fee39c39 (diff-d89de8881fc4b9f10cb3e4fc7b2463f3R53). However it looks the method was unused in journey at those point as well.
2014-12-05 16:09:03 +03:00
Tu Hoang
8ef51f64e5 Typo: Hello = Guten Tag (in German) 2014-12-05 12:54:15 +07:00
Rafael Mendonça França
2673a359e1 We don't need to call to_sym. Just compare the string 2014-12-04 15:24:16 -02:00
Rafael Mendonça França
dfa45ce7e1 Merge pull request #17792 from rockrep/master
allow 'all' for :domain option in addition to :all
2014-12-04 15:21:47 -02:00
Sergey Alekseev
d09bce96b4 remove unused #await_close
The method was added in 30d21dfcb7 (diff-5055d9f16b442adb1d2f0f65903a196bR141).
With the method call in 30d21dfcb7 (diff-cc7bb557df2247c0a42bc180fdb6eb05R47).
Later one more method call was added in 401787db4b (diff-cc7bb557df2247c0a42bc180fdb6eb05R183).
And both method calls were deleted in 3df07d093a (diff-cc7bb557df2247c0a42bc180fdb6eb05L47) and 3df07d093a (diff-cc7bb557df2247c0a42bc180fdb6eb05L189).

Just do `grep -nr 'await_close' .`.
2014-12-04 14:35:52 +03:00