aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-2/+1
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* Do not include default response headers for AC::MetalJon Moss2017-03-291-1/+1
| | | | | | | | | | | | In Rails 4.2, `ActionController::Metal` controllers did not include the default headers from `ActionDispatch::Response`. However, through e16afe6, and a general shift towards having `ActionController::Metal` objects contain `ActionDispatch::Response` objects (instead of just returning an array of status, headers, and body), this behavior was lost. This PR helps to restore the original behavior by having `ActionController::Metal` controllers generate Response objects without the default headers, while `ActionController::Base` now overrides the factory method to make sure its version does have the default headers.
* [docs] fix ActionController documentationHrvoje Šimić2017-03-121-2/+2
| | | | [ci skip]
* Remove deprecated ActionController::Metal.callRafael Mendonça França2017-01-031-8/+0
|
* Remove deprecated Metal#envRafael Mendonça França2017-01-031-5/+0
|
* Document and update API for `skip_parameter_encoding`Aaron Patterson2016-12-211-2/+2
| | | | | | | | This commit changes `parameter_encoding` to `skip_parameter_encoding`. `skip_parameter_encoding` will set encoding on all parameters to ASCII-8BIT for a given action on a particular controller. This allows the controller to handle data when the encoding of that data is unknown, for example file systems or truly binary parameters.
* Remove deprecated support to passing strings to the middleware stackRafael Mendonça França2016-10-101-1/+1
|
* Allow specifying encoding of parameters by actionKerri Miller2016-08-091-0/+4
| | | | | At GitHub we need to handle parameter encodings that are not UTF-8. This patch allows us to specify encodings per parameter per action.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-22/+22
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-2/+2
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-5/+5
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* partially revert 69009f4473637a44ade26d954ef5ddea6ff903f2Aaron Patterson2016-02-171-4/+1
| | | | | we need to continue setting the body on the request object because of Fiber based streaming templates. Fixes #23659
* Handle response_body= when body is nileileencodes2016-01-301-0/+1
| | | | | | | | | There are some cases when the `body` in `response_body=` can be set to nil. One of those cases is in `actionpack-action_caching` which I found while upgrading it for Rails 5. It's not possible to run `body.each` on a `nil` body so we have to return after we run `response.reset_body!`.
* Add missing punctuation mark [ci skip]Gaurav Sharma2015-11-181-1/+1
|
* Delete needless `require 'active_support/deprecation'`yui-knk2015-10-201-1/+0
| | | | | When `require 'active_support/rails'`, 'active_support/deprecation' is automatically loaded.
* move file sending to the response objectAaron Patterson2015-10-051-1/+5
| | | | | | | Just a slight refactor that delegates file sending to the response object. This gives us the advantage that if a webserver (in the future) provides a response object that knows how to do accelerated file serving, it can implement this method.
* commit the flash after the controller finishes being servicedAaron Patterson2015-09-251-0/+1
| | | | | Committing the flash needs to happen in order for the session to be written correctly, so lets guarantee that it actually does happen.
* stop applying default headers in ActionDispatch::ResponseAaron Patterson2015-09-231-1/+1
| | | | | | | | | | I'm making this change so that I can construct response objects that *don't* have the default headers applied. For example, I would like to construct a response object from the return value of a controller. If you need to construct a response object with the default headers, then please use the alternate constructor: `ActionDispatch::Response.create`
* allocate request objects with the env hash, set routes on the requestAaron Patterson2015-09-151-7/+0
| | | | | This commit is to abstract the code away from the env hash. It no longer needs to have the routes key hard coded.
* remove RackDelegation moduleAaron Patterson2015-08-261-35/+16
| | | | | | Since all controller instances are required to have a request and response object, RackDelegation is no longer needed (we always have to delegate to the response)
* include ActionView::Rendering in the minimal controllerAaron Patterson2015-08-261-1/+1
| | | | without this module, the content type is not set correctly
* `headers` should delegate to the response objectAaron Patterson2015-08-261-1/+2
|
* use the content_type method on the request objectAaron Patterson2015-08-261-1/+1
| | | | | since the controller always has a request on it, we can just ask the request for the content type.
* ask the response for the statusAaron Patterson2015-08-261-3/+2
| | | | | | The controller instance always has an instance of a response object. We should store the status code on the response object so that it's only store in one place.
* remove useless conditionalAaron Patterson2015-08-261-1/+1
| | | | | We always have a response object in controller instances, so we can remove this conditional
* remove useless conditionalAaron Patterson2015-08-261-1/+1
| | | | | controller instances always have a response object, so we don't need to test to see if there is one, just always call to_a on the response.
* provide a request and response to all controllersAaron Patterson2015-08-251-10/+27
| | | | | | | | | | Controllers should always have a request and response when responding. Since we make this The Rule(tm), then controllers don't need to be somewhere in limbo between "asking a response object for a rack response" or "I, myself contain a rack response". This duality leads to conditionals spread through the codebase that we can delete: * https://github.com/rails/rails/blob/85a78d9358aa728298cd020cdc842b55c16f9549/actionpack/lib/action_controller/metal.rb#L221-L223
* adding a direct dispatch method to controller classesAaron Patterson2015-08-251-0/+10
| | | | This saves a lambda and request allocation on each request.
* always dispatch to controllers the same wayAaron Patterson2015-08-251-0/+1
| | | | | controllers should always go through the `action` class method so that their middleware is respected.
* deprecate the env method on controller instancesAaron Patterson2015-08-071-0/+2
| | | | | | people should be accessing request information through the request object, not via the env hash. If they really really want at the env hash, then they can get it off the request.
* the request object manages `env`Aaron Patterson2015-08-071-2/+0
| | | | | remove the setter. The request object manages the env hash, so any mutations need to go through it
* stop using @_env in the controller instanceAaron Patterson2015-08-071-3/+2
| | | | | | | Actions are processed through `dispatch`, so they should have the request set on them before any user land code can be executed. Lets stop setting _env on the controller, and give access to it through the `env` method.
* Using strings or symbols for middleware class names is deprecated.Aaron Patterson2015-08-071-2/+1
| | | | | | | | | | Convert things like this: middleware.use "Foo::Bar" to this: middleware.use Foo::Bar
* move `valid?` conditional to the constructorAaron Patterson2015-08-071-11/+21
| | | | | use a strategy pattern to calculate the conditional in `valid?` in advance.
* simplify the Middleware constructorAaron Patterson2015-08-071-8/+17
| | | | | | We should do the hard work outside the constructor. Also fix the tests to not directly construct middleware objects, but to go through the stack object.
* the request class is never changed, so just use it directly in the method bodyAaron Patterson2015-08-071-3/+3
|
* Add `ActionController::Metal#set_request!`brainopia2015-01-211-2/+6
| | | | | Add `ActionController::Metal#set_request!` to set a request on controller instance without calling dispatch.
* Correctly use the response's status code calling headRobin Dupret2014-12-311-4/+1
| | | | | | | | | | | | | | | | 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.
* Make _status_code methods nodocPrathamesh Sonpatki2014-10-191-3/+3
| | | | | - Also one minor change for documenting url_for method in ActionController::Metal. [ci skip]
* copy edits[ci skip]Vijay Dev2014-08-021-3/+1
|
* Performed Returns true if redirect/render has happenedGaurish Sharma2014-07-191-1/+4
|
* Merge branch 'constraints'Aaron Patterson2014-05-271-3/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * constraints: rm reset_parameters because we automatically do it from 9ca4839a move path_parameter encoding check to the request object dispatcher doesn't need `call` anymore call `serve` with the request on dispatchers constraints class does not need the request class anymore give all endpoints a superclass skip the build business if the stack is empty stop hardcoding path_parameters and get it from the request we do not need to cache rack_app a redirect is not a dispatcher by definition, so eliminate test push is_a check up to where the Constraints object is allocated pass the request object to the application pass a request to `matches?` so we can avoid creating excess requests nothing is passed to `rack_app` anymore, so rm the params one fewer is_a check Constraints#app should never return another Constraints object, so switch to if statement eliminate dispatcher is_a checks push is_a?(Dispatcher) check in to one place Always construct route objects with Constraint objects Conflicts: actionpack/lib/action_controller/metal.rb
| * skip the build business if the stack is emptyAaron Patterson2014-05-261-2/+6
| |
| * stop hardcoding path_parameters and get it from the requestAaron Patterson2014-05-261-1/+2
| |
* | Remove duplicated to_s method call.Guo Xiang Tan2014-05-251-1/+1
|/
* use Proc.new to automatically do parameter checking for usAaron Patterson2014-05-231-3/+1
|
* fixes stack level too deep exception on action named 'status' returning ↵Christiaan Van den Poel2014-05-151-0/+4
| | | | 'head :ok'
* Update AC::Metal documentation example [ci skip]Yury Velikanau2014-04-151-1/+2
| | | | Include proper module since AV was extracted form AP as mentioned in #14659.