neighborland/cache_rocket

cache_replace_key is only replaced with the value the first time it is used in a view.

Closed this issue · 0 comments

Because CacheReplace::replace_from_hash uses sub! rather than gsub! if cache_replace_key is used with the same key more than once in a view only the first occurrence is replaced with the proper value.

For example:

= hidden_field_tag :person_id, cache_replace_key(:person_id)
= %span{id: "my_span_#{cache_replace_key(:person_id)}"}

Would yield something like

<input type='hidden' value='1234'/>
<span id='my_span_<cr person_id>'>

Expected output would be

<input type='hidden' value='1234'/>
<span id='my_span_1234'>