# Accessing rails render method outside of view / Decorating r

**URL:** <https://www.ruby-forum.com/t/accessing-rails-render-method-outside-of-view-decorating-r/76312>\
**Category:** Ruby\
**Created:** [November 17, 2006, 3:32pm UTC](https://www.ruby-forum.com/t/accessing-rails-render-method-outside-of-view-decorating-r/76312 "2006-11-17T15:32:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenngore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/439d5e/32.png) [@glenngore](https://www.ruby-forum.com/u/glenngore)\
**Post date:** [November 17, 2006, 3:32pm UTC](https://www.ruby-forum.com/t/accessing-rails-render-method-outside-of-view-decorating-r/76312/1 "2006-11-17T15:32:16Z")

</div>

I’m developing a plugin for rails that ultimately needs to assign some  
HTML to a javascript variable. In the interest of DRY, I want to be  
able to basically specify a partial and pass in a collection and then  
render the results. Because I’m assigning the output to a variable  
though I need to catch it and escape things like single quotes. The  
two options I can immediately see are:

1. Create a method similar to render in my own class. This would do  
the required operations on my object and then delegate the processing  
to render in ActionView. My problem is, how do I actually call the  
render method from within my own class?

2. Decorate the existing render method to recognise if my new object  
type is passed in and react accordingly. My problem is, how do I do  
that exactly? And in such away that if another developer wanted to do  
the same thing it would then wrap both of our render methods and not  
just overwrite the others?

Make sense? Any insight greatly appreciated
