This project is archived and is in readonly mode.
[PATCH] ActiveSupport::Memoizable - flush_cache fails for methods ending in ?
Reported by twalpole | September 3rd, 2009 @ 07:43 PM
Since the symbols passed to flush_cache are interpreted as part of a regex, passing a symbol ending in ? doesnt clear the cache for that method
foo?(a,b) <= memoized method
flush_cache(:foo?) <= does not flush the cache for foo? instead
it flushs for foo
a workaround is to do flush_cache('foo\?') but it would be better if this worked as expected
Comments and changes to this ticket
-
John Pignata September 4th, 2009 @ 10:29 PM
- Tag set to 3, activesupport, memoization
Added a quick fix and a test for this case.
-
John Pignata September 4th, 2009 @ 10:30 PM
- Tag changed from 3, activesupport, memoization to activesupport, memoization
-
John Pignata September 18th, 2009 @ 04:12 AM
- Tag changed from activesupport, memoization to activesupport, memoization, patch
- Title changed from ActiveSupport::Memoizable - flush_cache fails for methods ending in ? to [PATCH] ActiveSupport::Memoizable - flush_cache fails for methods ending in ?
-
CancelProfileIsBroken September 25th, 2009 @ 12:35 PM
- Tag changed from activesupport, memoization, patch to activesupport, bugmash, memoization, patch
-
Elad Meidar September 27th, 2009 @ 04:54 AM
- Tag changed from activesupport, bugmash, memoization, patch to activesupport, bugmash, bugmash-review, memoization, patch
+1 verified on master and 2-3-stable, patch applies cleanly.
As discussed on #railbridge some further tests for methods that end with ! as well could be nice, although not mandatory since ! is not a reserved regexp character.
-
sr.iniv.t September 27th, 2009 @ 07:05 AM
+1 verified.
The patch applies cleanly on master and 2-3-stable and all tests pass.
-
Kieran P September 27th, 2009 @ 07:09 AM
+1 verified. Though perhaps a Regexp.escape might be more appropriate?
-
CancelProfileIsBroken September 27th, 2009 @ 12:35 PM
- Tag changed from activesupport, bugmash, bugmash-review, memoization, patch to activesupport, bugmash-review, memoization, patch
-
John Pignata September 27th, 2009 @ 02:33 PM
Kieran - The reason I couldn't use Regexp.escape is that it causes tests for the unmemoize_all method to fail as it passes .* to flush_cache.
-
Repository September 28th, 2009 @ 03:29 AM
- State changed from new to committed
(from [d48ebeade2d907573e3fb086495b57b10115066c]) Escaping symbol passed into Memoizable's flush_cache for query methods to allow them to be cleared
Signed-off-by: Michael Koziarski michael@koziarski.com
[#3138 state:committed] http://github.com/rails/rails/commit/d48ebeade2d907573e3fb086495b57...
-
Rizwan Reza May 15th, 2010 @ 06:42 PM
- Tag changed from activesupport, bugmash-review, memoization, patch to activesupport, memoization, patch
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3138 [PATCH] ActiveSupport::Memoizable - flush_cache fails for methods ending in ? [#3138 state:committed] http://github.com/rails/rails/co...