[Rails] render_component vs. render_component_as_string?
Adam Fields
rails23049809 at aquick.org
Wed Feb 8 20:14:52 GMT 2006
On Wed, Feb 08, 2006 at 09:25:59AM -0500, Adam Fields wrote:
> I'm calling render_component in a helper.
>
> render_component :controller => target_controller, :action => "show", :id => target_id
>
> This works fine, except that passing the id in :params didn't work and
> I had to pass in an explicit :id parameter to get the target
> controller to override the id - is that documented anywhere?
>
> That's not my question. My question is - if I replace this with
> render_component_as_string, then try to render the string, I get an error:
>
> renderstring = render_component_as_string :controller => target_controller, :action => "show", :id => target_id
> render :inline => renderstring
>
> throws a undefined method error for render_component_as_string. Is
> this method not available in helpers? Is there an alternate approach
> to use for the same effect?
Reading the API docs, I've realized that render_component_as_string is
a protected method, so of course it's not going to work.
Is there a public way to get the contents of an action render as a
string from an arbitrary controller?
--
- Adam
** Expert Technical Project and Business Management
**** System Performance Analysis and Architecture
****** [ http://www.everylastounce.com ]
[ http://www.aquick.org/blog ] ............ Blog
[ http://www.adamfields.com/resume.html ].. Experience
[ http://www.flickr.com/photos/fields ] ... Photos
[ http://www.aquicki.com/wiki ].............Wiki
[ http://del.icio.us/fields ] ............. Links
More information about the Rails
mailing list