Sha256: 022c9b4b39752301ab62ca9be9e570546761ba5206bff29ac0bb22237c12628b
Contents?: true
Size: 834 Bytes
Versions: 2
Compression:
Stored size: 834 Bytes
Contents
# Monkey patch required to make `t` work as expected. Is this evil? # TODO Do we need to monkey patch other types of renderers as well? class ActionView::PartialRenderer alias_method :original_render, :render # See `content_for` in `lib/nice_partials/partial.rb` for something similar. def render(partial, context, block) if block partial_prefix = nice_partials_locale_prefix_from_view_context_and_block(context, block) context.nice_partials_push_t_prefix partial_prefix else # Render partial calls with no block should disable any prefix magic. context.nice_partials_push_t_prefix '' end result = original_render(partial, context, block) # Whether there was a block or not, pop off whatever we put on the stack. context.nice_partials_pop_t_prefix return result end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nice_partials-0.1.4 | lib/nice_partials/monkey_patch.rb |
nice_partials-0.1.3 | lib/nice_partials/monkey_patch.rb |