aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Check if the `request` variable isn't nil when calling render_to_stringJoan Karadimov2014-02-201-1/+3
| | | | | | | | | | | | closes #14125
* | | Introduce `render :body` for render raw contentPrem Sichanugrist2014-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Require action_view to fix missing constantPhilipe Fatio2014-02-071-0/+1
| | | | | | | | | | | | | | | Previously, requiring action_view/view_paths did cause an uninitialized constant error for ENCODING_FLAG, which is defined in action_view.
* | | Move the null mime type to request.formatCarlos Antonio da Silva2013-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TLDR: always return an object that responds to the query methods from request.format, and do not touch Mime::Type[] lookup to avoid bugs. --- Long version: The initial issue was about being able to do checks like request.format.html? for request with an unknown format, where request.format would be nil. This is where the issue came from at first in #7837 and #8085 (merged in cba05887dc3b56a46a9fe2779b6b228880b49622), but the implementation went down the path of adding this to the mime type lookup logic. This unfortunately introduced subtle bugs, for instance in the merged commit a test related to send_file had to be changed to accomodate the introduction of the NullType. Later another bug was found in #13064, related to the content-type being shown as #<Mime::NullType:...> for templates with localized extensions but no format included. This one was fixed in #13133, merged in 43962d6ec50f918c9970bd3cd4b6ee5c7f7426ed. Besides that, custom handlers were not receiving the proper template formats anymore when passing through the rendering process, because of the NullType addition. That was found while migrating an application from 3.2 to 4.0 that uses the Markerb gem (a custom handler that generates both text and html emails from a markdown template). --- This changes the implementation moving away from returning this null object from the mime lookup, and still fixes the initial issue where request.format.zomg? would raise an exception for unknown formats due to request.format being nil.
* | | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-12-201-1/+1
|\ \ \
| * | | Typos. return -> returns. [ci skip]Lauro Caetano2013-12-031-1/+1
| | | |
* | | | Require action_view explicitly in AC::BaseŁukasz Strzałkowski2013-12-081-0/+1
| | | |
* | | | Merge pull request #13189 from strzalek/retain-ap-av-depJeremy Kemper2013-12-051-0/+1
|\ \ \ \ | | | | | | | | | | Retain ActionPack dependency on ActionView. Fixes #12979.
| * | | | Retain ActionPack dependency on ActionViewŁukasz Strzałkowski2013-12-051-0/+1
| | | | |
* | | | | Improve a couple exception messages related to variants and mime typesCarlos Antonio da Silva2013-12-031-8/+10
|/ / / / | | | | | | | | | | | | | | | | Avoid one-liner conditionals when they are too big. Avoid concatenating strings to build error messages. Improve messages a bit.
* / / / Action Pack VariantsŁukasz Strzałkowski2013-12-042-1/+11
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, variants in the templates will be picked up if a variant is set and there's a match. The format will be: app/views/projects/show.html.erb app/views/projects/show.html+tablet.erb app/views/projects/show.html+phone.erb If request.variant = :tablet is set, we'll automatically be rendering the html+tablet template. In the controller, we can also tailer to the variants with this syntax: class ProjectsController < ActionController::Base def show respond_to do |format| format.html do |html| @stars = @project.stars html.tablet { @notifications = @project.notifications } html.phone { @chat_heads = @project.chat_heads } end format.js format.atom end end end The variant itself is nil by default, but can be set in before filters, like so: class ApplicationController < ActionController::Base before_action do if request.user_agent =~ /iPad/ request.variant = :tablet end end end This is modeled loosely on custom mime types, but it's specifically not intended to be used together. If you're going to make a custom mime type, you don't need a variant. Variants are for variations on a single mime types.
* | | calculate the ivars to remove in advance as a set and cache them in aAaron Patterson2013-11-061-8/+2
| | | | | | | | | | | | | | | | | | | | | constant. `view_assigns` can use the precalculated sets and remove instance variables without allocating any extra arrays
* | | use a set and reject to avoid array allocationsAaron Patterson2013-11-061-4/+11
| | |
* | | each_with_object on the view_assigns hashAaron Patterson2013-11-061-3/+1
| | |
* | | use slice to avoid range allocationAaron Patterson2013-11-061-1/+3
| | |
* | | these variables are also privateAaron Patterson2013-11-061-0/+1
| | |
* | | instance_variables returns symbols, so we should use symbols in our listAaron Patterson2013-11-061-1/+1
| | |
* | | Make AC standalone rendering workSantiago Pastorino2013-09-101-2/+5
| | |
* | | Remove BasicRendering testsJosé Valim2013-09-091-9/+1
| | |
* | | Remove remaining coupling with AV in MimeRespondsJosé Valim2013-09-091-0/+7
| | |
* | | Remove BasicRendering and remove template functionality from AbsC::RenderingJosé Valim2013-09-091-31/+12
| | |
* | | Move BasicRendering to AbstractControllerŁukasz Strzałkowski2013-09-031-0/+28
| | |
* | | Make Mime::TEXT default format in AbstractControllerŁukasz Strzałkowski2013-09-031-0/+1
| | |
* | | Move skeleton methods from AV to AbsCŁukasz Strzałkowski2013-09-031-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The methods: * #render_to_body * #render_to_string * #_normalize_render Haven't had anything specyfic to ActionView. This was common code which should belong to AbstractController
* | | Return to using protected_instance_variables in AVŁukasz Strzałkowski2013-09-021-5/+6
| | |
* | | Revert "Port all remaining self.protected_instance_variables to class methods"Łukasz Strzałkowski2013-09-022-10/+11
| |/ |/| | | | | This reverts commit 7de994fa215e9f4c2856d85034bc4dd7b65d0c01.
* | Port all remaining self.protected_instance_variables to class methodsŁukasz Strzałkowski2013-08-292-11/+10
| |
* | Add #rendered_format method to controllersŁukasz Strzałkowski2013-08-251-0/+5
| |
* | Improve AV::Rendering docsŁukasz Strzałkowski2013-08-251-0/+3
| |
* | Code formatting & typo fixesŁukasz Strzałkowski2013-08-251-1/+1
| |
* | Remove abstract_controller load hooksŁukasz Strzałkowski2013-08-251-2/+0
| |
* | Move protected_instance_variables & view_assigns to AbstractControllerŁukasz Strzałkowski2013-08-251-1/+20
| |
* | Create AbstractController::Rendering interfaceŁukasz Strzałkowski2013-08-251-0/+50
| | | | | | | | This interface should be use when implementing renderers.
* | Revert "Rename abstract_controller/rendering. to errors.rb"Łukasz Strzałkowski2013-08-251-0/+0
| | | | | | | | This reverts commit 6fe91ec5008838338e54ab8570f7c95ee0cdd8e8.
* | Rename abstract_controller/rendering. to errors.rbŁukasz Strzałkowski2013-08-251-0/+0
| | | | | | | | Since all rendering stuff was extracted to AV, the only thing that left was single class with error so file name wasn't relevant anymore
* | Hook up AV::Rendering on AV intializationŁukasz Strzałkowski2013-08-251-0/+2
| |
* | Move rendering from AP to AVŁukasz Strzałkowski2013-08-252-610/+0
| |
* | Move view_paths from AP to AVŁukasz Strzałkowski2013-08-251-96/+0
| |
* | Execute conditional procs on controller filters only for current action.Nicholas Jakobsen2013-08-101-1/+1
| | | | | | | | | | | | :only and :except options for controller filters are now added before :if and :unless. This prevents running :if and :unless procs when not on the specified. Closes #11786.
* | move `MissingHelperError` out of the `ClassMethods` module.Yves Senn2013-07-121-15/+18
| |
* | Show real LoadError on helpers requirePiotr Niełacny2013-07-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When helper try to require missing file rails will throw exception about missing helper. # app/helpers/my_helper.rb require 'missing' module MyHelper end And when we try do load helper class ApplicationController helper :my end Rails will throw exception. This is wrong because there is a helper file. Missing helper file helpers/my_helper.rb Now when helper try to require non-existed file rails will throw proper exception. No such file to load -- missing
* | use extract_options!Neeraj Singh2013-07-021-1/+1
| |
* | deprecating string based terminatorsAaron Patterson2013-05-141-1/+3
| |
* | Avoid leak into controller's action_methodsprintercu2013-04-181-0/+1
| |
* | Prefer find_by over dynamic finders in rdocSam Ruby2013-04-021-1/+1
| |
* | Fix typos in AP: "overriden" => "overridden"Carlos Antonio da Silva2013-03-301-1/+1
| |
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-03-302-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/adapter_test.rb guides/source/testing.md [ci skip]
| * | Capitalize the first letter of sentenceTatsuro Baba2013-03-181-1/+1
| | |
| * | Remove :all from *args options in AbstractController.helperBryan Ricker2013-03-161-1/+1
| | |
* | | Fixed grammarAnupam Choudhury2013-03-281-1/+1
| | |