aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer/partial_renderer.rb
Commit message (Collapse)AuthorAgeFilesLines
* Modify LogSubscriber for single partial's cache message.Stan Lo2016-08-081-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement naive partial caching mechanism. Add test for LogSubscriber Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it. Fixed tests Remove useless settings Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload. Update test's hash syntax Add configuration to enable/disable fragment caching logging Remove unless test and add new test to ensure cache info won't effect next rendering's log Move :enable_fragment_cache_logging config from ActionView to ActionPack Apply new config to tests Update actionview's changelog Update configuration guide Improve actionview's changelog Refactor PartialRenderer#render and log tests Mute subscriber's log instead of disabling instrumentation. Fix typo, remove useless comment and use new hash syntax Improve actionpack's log_subscriber test Fix rebase mistake Apply new config to all caching intstrument actions
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-162/+162
|
* applies new string literal convention in actionview/libXavier Noria2016-08-061-5/+5
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Use to_a to pre-buffer the collectionSteven Harman2016-07-261-3/+2
| | | | | | | | We can safely assume we're not dealing with an infinite collection as we're about to call `each` on it and collect the results until it terminates on its own. Given that, `to_a` is implemented by the normal Array-like objects, and less Array-like objects like `Enumerator` and `Enumerator::Lazy`.
* Default to an empty collection if falsey givenSteven Harman2016-07-261-1/+1
| | | | | | | This will ensure we attempt to render an empty collection, meaning we don't actually render anything at all. Allowing `nil` or a falsey value through results in calling `render_partial` rather than `render_collection`, which isn't what we want.
* Fix collection_from_options to allow EnumeratorsSteven Harman2016-07-261-1/+2
| | | | | | | | | | | | | An optimization was introduced in https://github.com/rails/rails/commit/27f4ffd11a91b534fde9b484cb7c4e515ec0fe77 which tried to `#to_ary` the collection to prevent unnecessary queries for ActiveRecord scopes/relations. If the given collection did not respond to `#to_ary`, and empty collection was returned. That meant you couldn't use collections built from `Enumerator` nor `Enumerable`. With this change, `#collection_from_options` will attempt the optimization, but fall back to passing along the given collection, as-is.
* systematic revision of =~ usage in AVXavier Noria2016-07-251-2/+3
| | | | | Where appropriate, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* We're not using $2 from this RegexpAkira Matsuda2016-03-051-1/+1
| | | | https://github.com/rails/rails/pull/24052/files#r55083975
* Fix partial rendering with dot in filenameBenjamin Quorning2016-03-041-1/+1
| | | | | | | | When rendering a collection with a partial whose filename contains a dot, e.g. "customer.mobile", we would set a `locals[:'customer.mobile']` variable instead of, as in earlier versions of Rails, `locals[:customer]`. This bug was introduced in da9038eaa5d19c77c734a044c6b35d7bfac01104.
* Instrument cached collection renders.Kasper Timm Hansen2016-02-201-12/+12
| | | | | | | | | | | | | | | | Augments the collection caching with some instrumentation that's logged. For collections that have been cached like: ```ruby <%= render partial: 'notifications/notification', collection: @notifications, cached: true %> ``` We'll output a line showing how many cache hits we had when rendering it: ``` Rendered collection of notifications/_notification.html.erb [0 / 100 cache hits] (3396.5ms) ```
* Make collection caching explicit.Kasper Timm Hansen2016-02-201-7/+0
| | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* Write to collection cache where the template is rendered.Kasper Timm Hansen2016-02-121-0/+7
| | | | | | | | 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.
* 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.
* zOMG 37 objects savedschneems2015-07-301-1/+1
|
* Remove duplicate private statementRoque Pinel2015-06-211-2/+0
|
* 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.
* [ci skip] Fix `&>` with `%>`yui-knk2015-03-251-9/+9
|
* Merge multi_fetch_fragments.Kasper Timm Hansen2015-02-201-2/+6
| | | | | | | | 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.
* marking private methods which dont work if called on their own anywaysEugene Gilburg2014-07-181-0/+2
|
* small refactors to actionview renderersEugene Gilburg2014-07-181-10/+10
|
* 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]
* Improve readability of sentence in partial-renderer docs [ci skip]Mac Martine2013-11-191-1/+1
|
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+492