aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/renderers.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use media_type instead of content_type internallyEugene Kenny2019-08-041-3/+3
| | | | | | | These calls to `content_type` were triggering the deprecation from c631e8d011a7cf3e7ade4e9e8db56d2b89bd530c in upgraded applications. We can use `media_type` in all of these cases to avoid the deprecation.
* Change `ActionDispatch::Response#content_type` returning Content-Type header ↵yuuji.yaginuma2019-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | as it is Since #35709, `Response#conten_type` returns only MIME type correctly. It is a documented behavior that this method only returns MIME type, so this change seems appropriate. https://github.com/rails/rails/blob/39de7fac0507070e3c5f8b33fbad6fced84d97ed/actionpack/lib/action_dispatch/http/response.rb#L245-L249 But unfortunately, some users expect this method to return all Content-Type that does not contain charset. This seems to be breaking changes. We can change this behavior with the deprecate cycle. But, in that case, a method needs that include Content-Type with additional parameters. And that method name is probably the `content_type` seems to properly. So I changed the new behavior to more appropriate `media_type` method. And `Response#content_type` changed (as the method name) to return Content-Type header as it is. Fixes #35709. [Rafael Mendonça França & Yuuji Yaginuma ]
* Clarify intentions around method redefinitionsMatthew Draper2017-09-011-1/+1
| | | | | | | | | Don't use remove_method or remove_possible_method just before a new definition: at best the purpose is unclear, and at worst it creates a race condition. Instead, prefer redefine_method when practical, and silence_redefinition_of_method otherwise.
* 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
|
* 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
* renderers typo fix [ci skip]ota42y2016-12-271-1/+1
|
* Remove obsolete comment about class-level respond_toAndrew White2016-10-011-2/+0
| | | | | | The class-level respond_to was extracted in ee77770 to responders gem [ci skip]
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix some typos in comments.Joe Rafaniello2016-05-041-1/+1
| | | | [ci skip]
* [ci skip] Fix typo Renderering --> RenderingAkshay Vishnoi2016-01-091-1/+1
|
* Group related methods togetherBenjamin Fleischer2016-01-031-67/+67
|
* Add ActionController:Renderers testBenjamin Fleischer2016-01-031-0/+9
| | | | To complement actionpack/test/controller/metal/renderers_test.rb
* Test ActionController::Renderers::use_renderersBenjamin Fleischer2015-12-311-0/+34
|
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-7/+7
| | | | | | | | | | | | | | | | | 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-7/+7
| | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* added description instead of remove usage [ci skip]Julio Lopez2015-07-111-1/+1
|
* Removed documentation that still mentioned using respond_with in placeRobert Evans2014-11-051-2/+1
| | | | | of respond_to. respond_with was moved into the responders gem and deprecated inside rails, so there is no need to mention it within rails itself.
* code gardening in ActionController::RenderersXavier Noria2014-09-041-7/+12
| | | | | | | | | | | | | | | | | | | * Renames _handle_render_options to _render_to_body_with_renderer, which is more intention-revealing. * The name of the dynamically generated method for a renderer with key :js was "_render_option_js". That name is too weak. :js is an option if you see the render argument as just a generic options hash, but in the context of renderers that's the renderer key, is what identifies the renderer. Now "_render_with_renderer_js" is generated instead, which is crystal clear. * The name of the dynamically generated method for the renderer was constructed using string literals in a few places. That is now encapsulated in a method. * Since we were on it, also removed a couple of redundant selfs.
* Address CVE-2014-4671 (JSONP Flash exploit)Greg Campbell2014-07-091-1/+1
| | | | | | Adds a comment before JSONP callbacks. See http://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/ for more details on the exploit in question.
* Change the JSON renderer to enforce the 'JS' Content TypeLucas Mazza2014-07-021-1/+4
| | | | | | | The controller can set the response format as 'JSON' before the renderer code be evaluated, so we must replace it when necessary. Fixes #15081
* Fix docs for ActionController::Renderers.addGuillermo Iguaran2014-05-261-1/+1
|
* Add ActionController::Renderers.remove.Zuhao Wan2014-05-201-0/+16
|
* ActionController::Renderers documentation fixStevie Graham2014-04-201-2/+2
| | | | | ActionController::Renderers::RENDERERS is an instance of Set. Docs incorrectly state that it's a Hash.
* Improve font of some code in API documentation [ci skip]Chun-wei Kuo2013-12-261-1/+1
| | | | | * Add "<tt>" or "+" to improve font of some code and filenames in API documentation * Does not contain wording changes
* Do not use instance variables if they are not reused elsewhereCarlos Antonio da Silva2013-09-061-2/+1
|
* Fail informatively in #respond_with when no appropriate #api_behavior ↵Ben Woosley2013-08-171-0/+7
| | | | | | | | | | | | renderer is available. Currently if a user calls #respond_with(csvable), but has not csv renderer available, Responder will just run through the default render behavior twice, raising ActionView::MissingTemplate both times. This changes ActionController::Metal::Responder#api_behavior to check in advance whether there is a renderer available, and raise ActionController::MissingRenderer if not.
* Multiple changes to 1,9 hash syntaxAvnerCohen2012-10-271-3/+3
|
* 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
|
* Removing ==Examples and last blank lines of docs from actionpackFrancesco Rodriguez2012-05-151-1/+0
|
* Avoid calling content type multiple timesJosé Valim2012-04-291-4/+6
|
* Merge remote-tracking branch 'upstream/master'Olli Jokinen2011-12-011-11/+9
|\
| * Refactor to make renderers a SetJose and Yehuda2011-10-151-11/+9
| |
* | Change mimetype to Mime::JS if JSONP is usedOlli Jokinen2011-07-281-1/+4
|/
* Slightly reorganize rendering stack.José Valim2011-04-181-3/+3
|
* removes support for render :updateXavier Noria2011-04-131-8/+1
|
* add some docs for ActionController::RenderersGabriel Horner2011-02-101-0/+37
|
* If a user wants json output then try best to render json output. In such ↵Neeraj Singh2010-11-241-1/+1
| | | | | | | | cases prefer kind_of(String) over respond_to?(to_str) [#5841 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove unused constantSantiago Pastorino2010-11-221-2/+0
|
* Remove unneeded metaprogramming and method generation in favor of direct ↵Santiago Pastorino2010-11-221-24/+10
| | | | definition
* renderer calls object.to_json when rendering :json => object [#5655 ↵Diego Carrion2010-09-271-1/+1
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Always downstream given options in :json, :xml and :js renderers and add ↵José Valim2010-04-221-2/+2
| | | | tests for it.
* It should be possible to render :json with optionswycats2010-04-201-1/+1
|
* adds missing requires for Object#blank? and Object#present?Xavier Noria2010-03-281-0/+1
|
* All tests pass without memoizing view_contextCarlhuda2010-03-181-1/+1
|
* Finish cleaning up rendering stack from views and move assigns evaluation to ↵José Valim2010-03-121-1/+2
| | | | controller (so plugins and/or controllers can overwrite just one method).
* Remove the renderer option from the hash.José Valim2010-02-241-1/+1
|