aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/rendering.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #30493 from ↵Ryuta Kamizono2017-09-021-1/+1
|\ | | | | | | | | koic/fix_cant_modify_frozen_string_error_in_ac_rendering Fix `can't modify frozen String` error in AC::Rendering
| * Fix `can't modify frozen String` error in AC::RenderingKoichi ITO2017-09-021-1/+1
| |
* | Remove unused requireRyuta Kamizono2017-09-011-2/+0
|/ | | | This is no longer used since 79a5ea9eadb4d43b62afacedc0706cbe88c54496.
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* 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
|
* [docs] fix ActionController documentationHrvoje Šimić2017-03-121-1/+1
| | | | [ci skip]
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Extract variant setter to process methodJon Moss2017-01-021-0/+6
| | | | | | | Provide an API interface similar to how format is handled in Controllers. In situations where variants are not needed (ex: in Action Mailer) the method will simply trigger a no-op, and will not affect end users.
* No need to nodoc private methodsAkira Matsuda2016-12-241-3/+3
|
* Do not try to set the content_type if the format is nilRafael Mendonça França2016-12-051-1/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Remove deprecated support to :text in renderRafael Mendonça França2016-10-101-12/+1
|
* Remove deprecated support to :nothing in renderRafael Mendonça França2016-10-091-5/+0
|
* Correct `render text:` deprecation messageJack Bracewell2016-09-141-1/+1
| | | The default Content-Type is `text/html`, not `text/plain`.
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-3/+3
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-47/+47
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Delete needless `require 'active_support/deprecation'`yui-knk2015-10-201-1/+0
| | | | | When `require 'active_support/rails'`, 'active_support/deprecation' is automatically loaded.
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-1/+1
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* stop calling deprecated methodsAaron Patterson2015-09-211-1/+1
| | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* eagerly allocate the renderer objectAaron Patterson2015-09-141-9/+5
| | | | | this means the reader doesn't need to lock, but does have the added cost of a new object created for every controller
* initialize `@renderer` to avoid ivar warningsAaron Patterson2015-09-141-1/+8
|
* add a lock when allocating the rendererAaron Patterson2015-09-141-1/+5
| | | | | The controller class is shared among threads, so we need to lock when allocating the Renderer.
* push content_type assigment in to metalAaron Patterson2015-09-081-4/+6
| | | | | everything above metal really doesn't care about setting the content type, so lets rearrange these methods to be in metal.
* avoid useless string allocationsAaron Patterson2015-09-081-1/+1
| | | | | | | _set_content_type only does something when there is a request object, otherwise the return value of _get_content_type is always ignored. This commit moves everything to the module that has access to the request object so we'll never to_s unless there is a reason
* only call self.content_type= when there is a responseAaron Patterson2015-08-261-3/+5
| | | | | Apparently the AbstractController (whatever "abstract" means) is expected to work without a request and response.
* Pull `plain` content type handling up to `render`Aaron Patterson2015-08-261-6/+2
| | | | | `render` is the only possible source for the `plain` option. Pulling the conditional up to the `render` method removes far away conditionals
* stop passing the options hash to `_process_format`Aaron Patterson2015-08-261-2/+2
| | | | | | We don't need to pass the full hash just to pull one value out. It's better to just pass the value that the method needs to know about so that we can abstract it away from "options"
* Add deprecation warning for `render :text`Prem Sichanugrist2015-07-171-0/+14
| | | | | | 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.
* Deprecate `:nothing` option for render methodMehmet Emin İNAÇ2015-05-281-0/+1
| | | | `head` method works similar to `render` method with `:nothing` option
* Add ActionController::Base.renderbrainopia2015-01-221-0/+3
|
* Add ActionController::Rendererbrainopia2015-01-221-0/+8
| | | | Render arbitrary templates outside of controller actions
* Removed single space padding from empty response body.Godfrey Chan2014-07-101-6/+2
| | | | | | | | | | | | `render nothing: true` or rendering a `nil` body no longer add a single space to the response body. The old behavior was added as a workaround for a bug in an early version of Safari, where the HTTP headers are not returned correctly if the response body has a 0-length. This is been fixed since and the workaround is no longer necessary. Use `render body: ' '` if the old behavior is desired.
* Do note remove `Content-Type` when `render :body`Prem Sichanugrist2014-03-051-3/+1
| | | | | | | | | | | | | `render :body` should just not set the `Content-Type` header. By removing the header, it breaks the compatibility with other parts. After this commit, `render :body` will returns `text/html` content type, sets by default from `ActionDispatch::Response`, and it will preserve the overridden content type if you override it. Fixes #14197, #14238 This partially reverts commit 3047376870d4a7adc7ff15c3cb4852e073c8f1da.
* Add `#no_content_type` attribute to `AD::Response`Prem Sichanugrist2014-02-181-6/+4
| | | | | Setting this attribute to `true` will remove the content type header from the request. This is use in `render :body` feature.
* Cleanup `ActionController::Rendering`Prem Sichanugrist2014-02-181-11/+27
|
* Introduce `render :html` for render HTML stringPrem Sichanugrist2014-02-181-2/+2
| | | | | | | | | This is an option for to HTML content with a content type of `text/html`. This rendering option calls `ERB::Util.html_escape` internally to escape unsafe HTML string, so you will have to mark your string as html safe if you have any HTML tag in it. Please see #12374 for more detail.
* Introduce `render :plain` for render plain textPrem Sichanugrist2014-02-181-2/+10
| | | | | | | | This is as an option to render content with a content type of `text/plain`. This is the preferred option if you are planning to render a plain text content. Please see #12374 for more detail.
* Introduce `render :body` for render raw contentPrem Sichanugrist2014-02-181-4/+13
| | | | | | | | | | | | This is an option for sending a raw content back to browser. Note that this rendering option will unset the default content type and does not include "Content-Type" header back in the response. You should only use this option if you are expecting the "Content-Type" header to not be set. More information on "Content-Type" header can be found on RFC 2616, section 7.2.1. Please see #12374 for more detail.
* #presence usedAkshay Vishnoi2013-11-141-5/+1
|
* Remove remaining coupling with AV in MimeRespondsJosé Valim2013-09-091-2/+5
|
* Remove BasicRendering and remove template functionality from AbsC::RenderingJosé Valim2013-09-091-2/+6
|
* render_to_string shouldn't play with response_bodySantiago Pastorino2013-09-041-4/+5
|
* Move BasicRendering to AbstractControllerŁukasz Strzałkowski2013-09-031-28/+0
|
* Make Mime::TEXT default format in AbstractControllerŁukasz Strzałkowski2013-09-031-4/+0
|
* Fix formatting of error messageŁukasz Strzałkowski2013-08-251-2/+1
| | | | Make it oneliner
* Change description of BasicRendering#renderŁukasz Strzałkowski2013-08-251-1/+1
| | | | | | We're not dealing with templates here [ci skip]
* Simplify if statementsŁukasz Strzałkowski2013-08-251-6/+4
|