aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer
Commit message (Collapse)AuthorAgeFilesLines
* Prefer empty? to any?.Kasper Timm Hansen2016-02-121-1/+1
| | | | | | | If the collection isn't empty any? will loop through it. Spare the loop and be more concise with what we're asking the collection about.
* Stop mutating return value.Kasper Timm Hansen2016-02-121-2/+3
| | | | | | `PartialRenderer.render_collection_with/without_template` returns an array of rendered partials. Avoid dup'ing and shifting it by indexing into the collection instead.
* Inline `fetch_or_cache_partial`.Kasper Timm Hansen2016-02-121-10/+6
| | | | Wasn't pulling its weight for a simple yield anymore.
* Write to collection cache where the template is rendered.Kasper Timm Hansen2016-02-122-9/+15
| | | | | | | | Moves us closer to having access to a local template variable, we can ask for eligibility and its virtual_path. Currently we rely on `@template`, which we don't have available when rendering collections without a fixed template.
* Only write to collection cache if we have a callable cache key.Kasper Timm Hansen2016-02-121-1/+5
| | | | | | | | | | | A callable cache key writes to the collection cache under a certain namespace. Which means if we don't have scoped cache key we can just rely on the `cache model_name do` in the templates to cache them. Less writes, more sharing. Add `assert_customer_cached` to better illustrate this in tests, and remove tests which then don't communicate as much.
* Remove useless callable_cache_key? check.Kasper Timm Hansen2016-02-121-2/+1
| | | | | | `automatic_cache_eligible?´ is only called if there was no `:cache` key to fetch in the `@options` via `cache_collection?`. So the check will always be false.
* Remove single_template_render? method.Kasper Timm Hansen2016-02-121-5/+1
| | | | | | Written when I didn't understand the internals as well. Action View generally just refers to `@template` when meaning a fixed template render. So follow that implicit convention.
* Don't search in locals for cache_options.Kasper Timm Hansen2016-02-121-3/+1
| | | | | | We should only support a top level `cache_options`. We also don't have to default the options to a hash as Active Support's cache defaults that arg to nil.
* allow :file to be outside rails root, but anything else must be inside the ↵Aaron Patterson2016-01-222-2/+2
| | | | | | rails view directory CVE-2016-0752
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-11-151-1/+1
|\
| * [ci skip] Use full component name in public API documentyui-knk2015-11-151-1/+1
| |
* | Respect value of `:object` if `:object` is false when renderingyui-knk2015-11-131-1/+1
| | | | | | | | | | This commit fixes the bug convering `false` to `locals[as]` when `options[:object]` is `false` (close #22260).
* | Require only necessary concurrent-ruby classes.Jerry D'Antonio2015-11-041-1/+1
|/
* Replaced `ThreadSafe::Map` with successor `Concurrent::Map`.Jerry D'Antonio2015-09-191-3/+3
| | | | | | | The thread_safe gem is being deprecated and all its code has been merged into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly the same as its predecessor except for fixes to two bugs discovered during the merge.
* Pass formats to lookup_contextRafael Mendonça França2015-08-241-1/+1
| | | | | | | | Before we were changing the state of the lookup_context for the duration of the with_layout_format block, but since we already know the formats we can just pass it explicitly. Related with 8d7ce0f22aee09d20091a4dc58cb379a09d13e26
* remove useless case in #resolve_layout.Nick Sutterer2015-08-241-2/+0
|
* remove LookupContext#with_layout_format by passing formats for layouts ↵Nick Sutterer2015-08-242-8/+11
| | | | explicitely.
* zOMG 37 objects savedschneems2015-07-301-1/+1
|
* Fix cache issue when different partials use the same collectionRoque Pinel2015-06-281-1/+1
| | | | | | | | | Adds the `virtual_path` option to `cache_fragment_name` so it can be provided when needed. That allows `cache_collection_render` to get the appropriate cache key with the digest generated based on the template and prevent collision with other templates that cache the same collection.
* Remove duplicate private statementRoque Pinel2015-06-211-2/+0
|
* spelling fix [ci skip]karanarora2015-05-191-1/+1
|
* Do not put partial name to local_assigns when rendering without an objectHenrik Nygren2015-05-141-1/+1
| | | | | | | | When one rendered a partial template without specifying an object or a collection (e.g. <%= render partial: 'partial_name' %>), Rails would make an object called :partial_name available in local_assigns. I don't think this was the intended behavior, since no local variable called 'partial_name' gets defined in the view.
* Merge pull request #19535 from JuanitoFatas/doc/av-commentYves Senn2015-03-271-1/+1
|\ | | | | [ci skip] Unify the code comment in ActionView::Renderer#render_template...
| * [ci skip] Unify the code comment in ActionView::Renderer#render_template.Juanito Fatas2015-03-271-1/+1
| |
* | Add missing :html option in determine_template error message.Juanito Fatas2015-03-271-1/+1
|/
* [ci skip] Fix `&>` with `%>`yui-knk2015-03-251-9/+9
|
* Collections automatically cache and fetch partials.Kasper Timm Hansen2015-02-211-2/+15
| | | | | | | | | | | | | | | | | | | | | | | Collections can take advantage of `multi_read` if they render one template and their partials begin with a cache call. The cache call must correspond to either what the collections elements are rendered as, or match the inferred name of the partial. So with a notifications/_notification.html.erb template like: ```ruby <% cache notification %> <%# ... %> <% end %> ``` A collection would be able to use `multi_read` if rendered like: ```ruby <%= render @notifications %> <%= render partial: 'notifications/notification', collection: @notifications, as: :notification %> ```
* Merge multi_fetch_fragments.Kasper Timm Hansen2015-02-202-2/+63
| | | | | | | | Makes caching a collection of template partials faster using `read_multi` on the Rails cache store. Some caching implementations have optimized `read_multi` so we don't have to check in the cache store for every template.
* Partial template name does no more have to be a valid Ruby identifierAkira Matsuda2015-02-061-3/+2
| | | | because the partial renderer would not create an lvar per each template since c67005f221f102fe2caca231027d9b11cf630484
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-01-031-5/+5
|\
| * Fix "Rendering" not to link to AV::Renderingclaudiob2014-12-251-5/+5
| | | | | | | | | | | | | | The "Rendering" word in the titles is not meant to be a link to the documentation for ActionView::Rendering. [ci skip]
* | fix error message of option as with invalid charters in partial renderingAngelo capilleri2014-12-291-2/+10
|/ | | | | before this PR IDENTIFIER_ERROR_MESSAGE could lead to misunderstand the convention of partial name. Added OPTION_AS_ERROR_MESSAGE for unvalid charter in as option.
* Fix warning in AV testsSean Griffin2014-11-251-2/+4
| | | | Originally caused by #17771
* Local vars should exist in partials for falsy `:object:` values tooAgis-2014-11-251-2/+2
| | | | | | | | | | | | c67005f221f102fe2caca231027d9b11cf630484 made the local var in partials available only if what passed to `:object` was truthy. For example this would not make the local variable `foo` available inside the partial: render partial: 'foo', object: false Fixes #17373.
* Avoid creating unneeded Hash instance and calling slow Hash#fetchAkira Matsuda2014-10-251-1/+1
|
* marking private methods which dont work if called on their own anywaysEugene Gilburg2014-07-182-1/+5
|
* small refactors to actionview renderersEugene Gilburg2014-07-183-16/+15
|
* Fix typo on the variable nameRafael Mendonça França2014-07-161-8/+8
|
* Document the PartialIteration objectRafael Mendonça França2014-07-161-3/+9
|
* Build only one PartialIteration object for loopRafael Mendonça França2014-07-161-11/+18
|
* No need to have a file to PartialIteration classRafael Mendonça França2014-07-161-1/+17
| | | | This class is only used on the PartialRenderer.
* Added PartialIteration class used when rendering collectionsJoel Junström2014-07-161-13/+28
| | | | | | | | | | | | The iteration object is available as the local variable "template_name_iteration" when rendering partials with collections. It gives access to the +size+ of the collection beeing iterated over, the current +index+ and two convinicence methods +first?+ and +last?+ "template_name_counter" variable is kept but is deprecated. [Joel Junström + Lucas Uyezu]
* Introduce `render :html` for render HTML stringPrem Sichanugrist2014-02-181-0/+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-1/+3
| | | | | | | | 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-2/+4
| | | | | | | | | | | | 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.
* typos rectified [ci skip]Aayush khandelwal2013-12-121-1/+1
|
* Improve readability of sentence in partial-renderer docs [ci skip]Mac Martine2013-11-191-1/+1
|
* Fix default rendered format problem when calling render method without ↵kennyj2013-07-151-1/+1
| | | | :content_type option. Closes #11393.
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-205-0/+788