aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
Commit message (Collapse)AuthorAgeFilesLines
...
| * Make per form token work when method is not providedRafael Mendonça França2016-02-221-1/+2
| | | | | | | | | | | | When `button_to 'Botton', url` form was being used the per form token was not correct because the method that is was being used to generate it was an empty string.
| * Do not pass more options that are needed.Rafael Mendonça França2016-02-221-1/+1
| | | | | | | | | | We only need action and method so pass them explicitly instead of merging the hash with HTML options.
| * Merge pull request #23752 from vipulnsward/23524-fix-button_to_deleteRafael Mendonça França2016-02-221-1/+1
| |\ | | | | | | | | | Fixed passing of delete method on button_to tag, creating wrong form csrf token
| | * Refactored Request Forgery CSRF PerFormTokensController tests and DRY'ed ↵Vipul A M2016-02-221-1/+1
| | | | | | | | | | | | them up.
| | * Fixed passing of delete method on button_to tag, creating wrong form csrf tokenVipul A M2016-02-211-2/+2
| | | | | | | | | | | | Fixes #23524
| * | [ci skip] Document collection caching better.Kasper Timm Hansen2016-02-211-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | Why are we here? Where did we come from? Where are we going... in 5 minutes? These questions are not answered in this documentation. Instead collection caching is better clarified. How it works, how it can share caches with individual templates.
| * | [ci skip] Clarify collection caching went EXPLICIT.Kasper Timm Hansen2016-02-211-4/+9
| | | | | | | | | | | | | | | | | | | | | Yo dawg, we so explicit if we were a music track, yo' iPhone's Music app would put an E next to it. *drops mic*
| * | Merge pull request #23791 from prathamesh-sonpatki/fix-changelogRafael França2016-02-201-1/+1
| |\ \ | | | | | | | | Improve CHANGELOG for https://github.com/rails/rails/pull/17043 [ci skip]
| | * | Improve CHANGELOG for https://github.com/rails/rails/pull/17043 [ci skip]Prathamesh Sonpatki2016-02-201-1/+1
| | |/
| * | Merge pull request #23695 from kaspth/remove-automatic-collection-cachingKasper Timm Hansen2016-02-2010-194/+102
| |\ \ | | |/ | |/| Make collection caching explicit.
| | * Instrument cached collection renders.Kasper Timm Hansen2016-02-205-20/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-207-174/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'master' into treewipAaron Patterson2016-02-193-4/+86
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: eliminate warnings about multiple primary keys on habtm join tables Add methods to array delegation from `Relation` Fix button_to's params option to support nested names. Dependencies clean up Deprecate AC::Parameters#== with a Hash Fix AC::Parameters#== with other AC::Parameters Tests for AC::Parameters#== better docs for ActiveSupport::TestCase#assert_nothing_raised remove needless `debug_exception_response_format` config [ci skip] partial pass over the API guide [ci skip] Fix `unsubscribed` server side behavior Use a semaphore to signal message availability Fix master build Remove github gems from the master bug report templates Truncate ActionCable broadcast message to 300 chars Remove unused require
| * | Merge pull request #17043 from jcoleman/fix-nested-params-in-button-toRafael França2016-02-193-4/+86
| |\ \ | | |/ | |/| Fix button_to's params option to support nested names.
| | * Fix button_to's params option to support nested names.James Coleman2016-02-193-4/+86
| | | | | | | | | | | | | | | | | | In e6e0579defcfcf94ef1c4c1c7659f374a5335cdb the `params` option was added to the `button_to` helper. However, the patch doesn't support nested hashes so `{a: {b: 'c'}}` for example gets turned into a hidden form input with the name 'a' and the value being the string representation of the `{b: 'c'}` nested hash. Since Rails supports nested hashes everywhere else (and even in the URL params of link_to and button_to), I believe this to be a bug/unfinished feature.
* | | push partial name regexp upAaron Patterson2016-02-181-2/+2
| | | | | | | | | | | | | | | we know that all child templates will be considered as "partials", so the only one that needs detection by name is the root node
* | | push injected dependencies up to the `digest` methodAaron Patterson2016-02-182-9/+9
| | | | | | | | | | | | | | | | | | Only the root node has injected dependencies, so we don't need to care about them at lower levels. This change pushes the injected dependencies up to where the user passed them in.
* | | use the class level digest method for calculating the digestAaron Patterson2016-02-181-3/+1
| | |
* | | cache all subnodes in the digest cacheAaron Patterson2016-02-182-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | this is for backwards compatibility. We should remove this after 5-0-stable is created because digest calculation should be amortized. Caching digests of subtrees will speed up digests for other trees that share the same children. However, this will also increase memory, and after the app warms up, then those subtrees will never be reused which means that memory is wasted.
* | | Merge branch 'master' into treewipAaron Patterson2016-02-184-13/+33
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (27 commits) move digest cache on to the DetailsKey object remove object `hash` cache [ci skip] fix suggested change-replace 'an' with 'the in Rails engine guide' Missing documentation about hash algorithm option for MessageVerifier [ci skip] set `skip_listen` option to dummy appplication Fix the language in engines guide Add accidentally removed `#` [ci skip] fields_for_style needs to test for AC::Parameters Fix indentation for code block in changelog Remove accidentally duplicated change log title [ci skip] partially revert 69009f4473637a44ade26d954ef5ddea6ff903f2 Remove needless `case_insensitive_comparison` in mysql2 adapter modify to `error` also abort when specify fail fast option Implement ActionController::Parameters#inspect remove unused method Remove unused Journey code Add Action Cable CHANGELOG in release notes [ci skip] Show proper error message when a non-relation object is passed to AR::Relation#or Fix semantics of test names for finish option in batches_test Fix typo ... Conflicts: actionview/lib/action_view/digestor.rb
| * | move digest cache on to the DetailsKey objectAaron Patterson2016-02-183-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves digest calculation cache on to the details key object. Before, the digest cache was a class level ivar, and one of the keys was the hash value of the details key object: https://github.com/rails/rails/blob/13c4cc3b5aea02716b7459c0da641438077f5236/actionview/lib/action_view/digestor.rb#L28 An object's hash value is not unique, so it's possible for this cache key to produce colliding keys with no resolution. This commit move cache on to the details key object itself, so we know that the digests are always unique per details key object.
| * | remove object `hash` cacheAaron Patterson2016-02-181-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't think caching this method makes any difference on Ruby 2.0: ``` require 'benchmark/ips' class Foo alias :object_hash :hash attr_reader :hash def initialize @hash = object_hash end end class Bar end hash = {} foo = Foo.new bar = Bar.new Benchmark.ips do |x| x.report("foo") { hash[foo] } x.report("bar") { hash[bar] } x.report("foo.hash") { foo.hash } x.report("bar.hash") { bar.hash } end __END__ [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 118.361k i/100ms bar 118.637k i/100ms Calculating ------------------------------------- foo 7.944M (± 3.1%) i/s - 39.769M bar 7.931M (± 3.4%) i/s - 39.625M [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 122.180k i/100ms bar 120.492k i/100ms foo.hash 123.397k i/100ms bar.hash 119.312k i/100ms Calculating ------------------------------------- foo 8.002M (± 4.2%) i/s - 39.953M bar 8.037M (± 4.5%) i/s - 40.124M foo.hash 8.819M (± 3.9%) i/s - 44.053M bar.hash 7.856M (± 4.1%) i/s - 39.254M ```
| * | Merge pull request #23662 from rthbound/adds-missing-digestor-nested-deps-testsYves Senn2016-02-172-0/+12
| |\ \ | | | | | | | | adds missing tests for Digestor#nested_dependencies
| | * | adds tests for Digestor#nested_dependenciesRyan T. Hosford2016-02-132-0/+12
| | | |
* | | | convert `digest` to only use kwargsAaron Patterson2016-02-171-4/+2
| | | |
* | | | fix rake tasksAaron Patterson2016-02-162-6/+6
| | | |
* | | | remove more dead codeAaron Patterson2016-02-161-10/+2
| | | |
* | | | remove dead codeAaron Patterson2016-02-161-141/+34
| | | | | | | | | | | | | | | | | | | | | | | | this commit removes unused code and changes the monitor to a mutex. Since the digest doesn't recurse on itself anymore, we can just use a mutex
* | | | change internal implementation to use a treeAaron Patterson2016-02-162-15/+32
| | | |
* | | | convert structs to a regular classAaron Patterson2016-02-161-8/+12
| | | |
* | | | clean up classes a littleAaron Patterson2016-02-161-12/+23
| | | |
* | | | fix recursive templatesAaron Patterson2016-02-162-22/+43
| | | |
* | | | pull template check up to match existing behaviorAaron Patterson2016-02-162-14/+14
| | | | | | | | | | | | | | | | also remove the EMPTY node since we won't need it
* | | | introduce a `tree` factory method for creating the dep treeAaron Patterson2016-02-162-0/+62
|/ / / | | | | | | | | | also add an EMPTY sentinel node
* | | Merge pull request #23203 from vipulnsward/22979-show-tags-on-exceptionRichard Schneeman2016-02-162-5/+5
|\ \ \ | | | | | | | | WIP: Errors in logs should show log tags as well.
| * | | WIP: Errors in logs should show log tags as well.Vipul A M2016-02-122-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changed formatted_code_for to return array of logs to be tagged for each line - Changed some render tests to match new behaviour of return Fixes #22979
* | | | Test to check if the data-attr if nil is same or notSourav Moitra2016-02-142-0/+7
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | if data attribute is nil it is ignored if value is nil the pair is ignored if value is nil it is skipped Improved test for data attr nil
* | | Fix grammar `a` to `an` [ci skip]Ryuta Kamizono2016-02-131-1/+1
| |/ |/|
* | push kwargs up to the user facing APIAaron Patterson2016-02-123-13/+13
| | | | | | | | | | | | | | this lets us leverage Ruby's kwarg handling (exceptions for missing params, etc) ASAP which allows us to skip active support method calls and make sure the exception stack is closer to where the user called the methods.
* | 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.
* | the lookup context looks in the cwd, so prefix isn't necessaryAaron Patterson2016-02-121-2/+1
| |
* | use a real LookupContext in the digest testsAaron Patterson2016-02-121-28/+6
| | | | | | | | | | This will ensure that the digestor stays in parity with the LookupContext object.
* | 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.
* | use assert_not_equal so there will be better error messagesAaron Patterson2016-02-121-1/+1
| | | | | | | | in the case of failure it is nice to see what the two digests are.