[Rails] Re: calling render_to_string outside of controller
Ezra Zygmuntowicz
ezmobius at gmail.com
Sat May 27 01:17:34 GMT 2006
Hi!
On May 26, 2006, at 3:24 PM, charlie bowman wrote:
> charlie bowman wrote:
>> How can I call render_to_string outside of a controller. I'm
>> stuck on
>> this. I've nearly got my plugin finished but I can't seem to get
>> this
>> to work. The method is in ActionController::Base but it is
>> protected.
>
> I'm going to keep posting my attempts, maybe someone out there
> knows how
> to do this. Here is the offending portion on code. It almost
> workd but
> I get this:
>
> protected method `render_to_string' called for
> #<ActionController::Base:0xb7850f14>
>
> def execute_ruby_code( str )
> render_class = ActionController::Base.new
> logger.error('test')
> logger.error(render_class.class)
> str = str.gsub(/\<ruby\>(.*?)\<\/ruby\>/) do |match|
> match = render_class.render_to_string(:inline => $1, :type =>
> 'rhtml')
> logger.error(match)
> end
> str
> end
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
match = render_class.send(:render_to_string, {:inline =>
$1, :type => 'rhtml'})
-Ezra
More information about the Rails
mailing list