aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Increase readability of ternary statement in build methodbuddhamagnet2013-04-201-2/+1
|
* replace match with get verb in ActionController::MetalGaurish Sharma2013-04-161-1/+1
|
* Missing or unneeded require extract_optionsAkira Matsuda2013-02-011-0/+1
|
* Multiple changes to 1,9 hash syntaxAvnerCohen2012-10-271-2/+2
|
* removes unnecessary selfXavier Noria2012-09-171-1/+1
|
* revises RDoc in AC::Metal [ci skip]Xavier Noria2012-09-171-14/+7
|
* removes unnecessary selfXavier Noria2012-09-171-1/+1
|
* load active_support/core_ext/class/attribute in active_support/railsXavier Noria2012-08-021-1/+0
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* adding a buffered stream to the response objectAaron Patterson2012-07-291-1/+1
|
* Use performed? instead of checking for response_bodyCarlos Antonio da Silva2012-01-191-4/+4
| | | | | | * Check for performed? instead of response_body * Change performed? to return a boolean * Refactor AC::Metal#response_body= to reuse variable
* Do not deprecate performed.José Valim2012-01-191-0/+4
|
* refactor response_body= methodVasiliy Ermolovich2012-01-141-7/+1
| | | | response_to?(:each) returns false for strings in ruby 1.9, so there is no need for these checks
* Fix AC::Metal#response_body= to store same value on Ruby 1.8 and 1.9Akira Matsuda2011-11-071-1/+7
| | | | This was because String#respond_to?(:each) differs in 1.8 and 1.9