Commit Graph

3840 Commits

Author SHA1 Message Date
Prem Sichanugrist
6790228b39 Add deprecation warning for render :text
We've started on discouraging the usage of `render :text` in #12374.
This is a follow-up commit to make sure that we print out the
deprecation warning.
2015-07-17 21:12:47 -04:00
Zoltan Kiss
ea6e7ffd78 Standardize ActionController::Parameters#to_unsafe_h return value
`ActionController::Parameters#to_h` returns a hash, so lets have
`ActionController::Parameters#to_unsafe_h` return a hash instead of
an `ActiveSupport::HashWithIndifferentAccess` for consistency.
2015-07-15 19:20:21 -05:00
Prem Sichanugrist
84b861f1aa Update documentation on AC::Parameters 2015-07-15 13:02:53 -04:00
Prem Sichanugrist
14a3bd520d Make AC::Parameters not inherited from Hash
This is another take at #14384 as we decided to wait until `master` is
targeting Rails 5.0. This commit is implementation-complete, as it
guarantees that all the public methods on the hash-inherited Parameters
are still working (based on test case). We can decide to follow-up later
if we want to remove some methods out from Parameters.
2015-07-15 11:11:36 -04:00
Aaron Patterson
4d4d764ab6 Rack implements redirect? so we don't need it
Rack [already implements `redirect?` on the response object](1569a985e1/lib/rack/response.rb (L141)) so we don't need to implement our own.
2015-07-14 11:22:35 -07:00
Prem Sichanugrist
e26d11c876 Change AC::TestResponse to AD::TestResponse
ActionController::TestResponse was removed in d9fe10c and caused a test
failure on Action View as its test case still refers to it.
2015-07-14 09:27:42 -04:00
Aaron Patterson
d9fe10cb8a only have one TestResponse class 2015-07-13 17:52:02 -07:00
Aaron Patterson
b37e29ec2d move buffer caching on to the buffer 2015-07-13 17:48:56 -07:00
Robin Dupret
48609420b8 Merge pull request #20736 from antoine-lizee/docs
[ci skip] docs: making clear that perform_caching has a limited impact
2015-07-13 22:41:45 +02:00
antoine.lizee
89a55edd59 [ci skip] doc: making clear that perform_caching has a limited impact 2015-07-13 11:35:18 -07:00
Claudio B.
e0a7e7b0ee Merge pull request #20842 from TheBlasfem/removed_usage_lines_docs
Removed usage line docs [ci skip]
2015-07-11 22:38:05 -07:00
Julio Lopez
789a2df86e added description instead of remove usage [ci skip] 2015-07-11 21:28:07 -05:00
Aaron Patterson
3c5bd78ddb we don't really need an extra method to set the script name 2015-07-10 14:19:11 -07:00
Aaron Patterson
85903d1b08 Remove useless conditional
PATH_INFO is already set, so this branch will never execute.
2015-07-10 14:19:11 -07:00
Aaron Patterson
e459b29fb4 default PATH_INFO to the generated path
we were already generating a path in the previous code (it was just not
returned), so lets just use the already computed path to popluate the
PATH_INFO header
2015-07-10 14:19:11 -07:00
Aaron Patterson
8b4eca09a5 always default the SCRIPT_NAME to whatever is on the controller 2015-07-10 14:19:11 -07:00
Aaron Patterson
889a4a3da0 remove useless ivar clearing
Since we only work with new instances, these ivars will not be set.
2015-07-10 14:19:11 -07:00
Aaron Patterson
314ac0cd57 call the path_parameters= setter rather than rely on mutations
We should call the setter on `path_parameters` so that we know the hash
will only contain the values that we've set.
2015-07-10 14:19:10 -07:00
Aaron Patterson
f1fcf9b526 start collecting env mutations
I'd like to put all env mutations together so we can understand how to
change this code to call `call` on the controller
2015-07-10 14:19:10 -07:00
Aaron Patterson
0adb8f8fa6 Parameters are converted to a query string
Since parameters are converted to a query string, they will
automatically be turned in to strings by the query parser
2015-07-10 14:19:10 -07:00
Aaron Patterson
11bc078928 no more HWIA
non_path_parameters is used internally (it never escapes this method) so
we should be able to safely use a regular hash.
2015-07-10 14:19:10 -07:00
Aaron Patterson
79ab812663 remove param dup'ing logic
since we are serializing parameters, we don't need to do all the dup
checks on each object.
2015-07-10 14:19:10 -07:00
Aaron Patterson
c546a2b045 encode / decode parameters before assigning them to the request
We should roundtrip the parameters through their respective encoders /
decoders so that the controller will get parameters similar to what they
actually get in a real world situation
2015-07-10 14:19:10 -07:00
Aaron Patterson
394b7be036 set parameters as a query string
We should convert request parameters to a query string, then let the
request object parse that query string.  This should give us results
that are more similar to the real-world
2015-07-09 10:12:19 -07:00
Aaron Patterson
5ea8efecd0 build and assign parameters rather than rely on mutations
We should assign parameters to the request object rather than mutate the
hash that is returned by `query_parameters` or `request_parameters`
2015-07-08 16:43:58 -07:00
Aaron Patterson
9f09848918 assign the cookie hash on request allocation
this prevents mutations from being available globally
2015-07-08 16:27:02 -07:00
Aaron Patterson
f65fd25f04 request objects are no longer recycled
Instead of trying to manually clear out a request object, lets just
allocate a new one.  The rack ENV is reused and cleaned (still), but the
request object is not.
2015-07-08 16:23:32 -07:00
Aaron Patterson
78a5124bf0 add a new constructor for allocating test requests 2015-07-08 16:09:49 -07:00
Aaron Patterson
3cae6bc5fc pass the starting env and session to build_request 2015-07-08 15:17:50 -07:00
Aaron Patterson
3806eb70a6 pass the session and env in to the test request 2015-07-08 14:32:54 -07:00
Aaron Patterson
2b5d309aeb allocate new responses rather than recycling them
There is no reason to "recycle" response objects when we can just
allocate a new one.
2015-07-08 11:16:44 -07:00
eileencodes
8363b879fe pass cookies from the jar in the HTTP_COOKIE header
we should be pushing the cookies in via headers rather than maintaining
some object and "recycling" it.
2015-07-07 14:31:34 -07:00
eileencodes
ae29142142 Send cookies with request 2015-07-07 14:31:34 -07:00
Kasper Timm Hansen
991e98f564 Merge pull request #20276 from davetron5000/revert-head-on-no-template
Allow default_render to take a block to customize behavior when there's no template
2015-06-27 22:18:17 +02:00
Yves Senn
8bf60b02b8 Merge pull request #20659 from vngrs/strong_parameters_unpermitted_parameters_wrong_doc_fix
Fix the documentation about ActionController::UnpermittedParameters [ci skip]
2015-06-22 08:49:27 +02:00
Mehmet Emin İNAÇ
9f62180ab2 Fix the documentation about ActionController::UnpermittedParameters [ci skip] 2015-06-22 07:28:51 +03:00
Mehmet Emin İNAÇ
2489a27d4d Fix the documentation about ActionController::ParameterMissing [ci skip] 2015-06-22 05:02:09 +03:00
Dave Copeland
6fda6c3778 Override default_render's behavior with a block
In 0de4a23 the behavior when there is a missing template was changed to
not raise an error, but instead head :no_content.  This is a breaking
change and some gems rely on this happening.

To allow gems and other code to work around this, allow
`default_render` to take a block which, if provided, will
execute the contents of that block instead of doing the `head :no_content`.
2015-06-20 12:00:07 -04:00
Mehmet Emin İNAÇ
cf81a3bae0 Deprecate passing hash as first parameter into ActionController::Head 2015-06-15 23:53:45 +03:00
Robin Dupret
a023d5391e A few documentation edits [ci skip] 2015-06-15 18:16:40 +02:00
Prathamesh Sonpatki
fe117ce776 Add missing "header" word in documentation of Token#authentication_request [ci skip] 2015-06-14 18:57:27 +05:30
Victor Costan
eb8042494f Update RDoc for ActionController::TestCase for kwargs. 2015-06-12 00:03:49 -04:00
Sean Griffin
e2dfa54db8 Merge pull request #20522 from colby-swandale/doc-update
fixed sring to be string in ActiveRecord::Base params documentation [ci skip]
2015-06-11 17:09:37 -06:00
Colby Swandale
5a1bbb2ea7 fixed sring to be string in ActiveRecord::Base params documentation 2015-06-12 06:49:26 +10:00
Santiago Pastorino
1fd42f3338 Mention that doing nothing in Rails API controllers returns 204 2015-06-11 16:54:17 -03:00
Jorge Bejar
6c16577311 Return 204 if render is not called in API controllers 2015-06-11 16:54:17 -03:00
Jorge Bejar
a2c9a73084 Include ParamsWrapper in AC::API
ParamsWrapper was initially removed from API controllers according to
the following discusision:
https://github.com/rails-api/rails-api/issues/33

However, we're including it again so Rails API devs can decide
whether to enable or disable it.
2015-06-11 16:54:16 -03:00
Santiago Pastorino
7db63f3d35 Fix MimeResponds example in AC::API documentation 2015-06-11 16:54:14 -03:00
Jorge Bejar
2487bfb39a Do not say that Api Controllers are faster than regular ones in docs 2015-06-11 16:54:14 -03:00
Jorge Bejar
fd2508522c Remove Compatibility module since we don't remember why it was added 😄 2015-06-11 16:54:14 -03:00