Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert erb to html?

Imagine in rails I have @template that is an instance of ActionTemplate::View.

Question is: How can I convert @template whose @template.source is <%= "hello from erb" %> to hello from erb?? thanks

like image 688
David Rz Ayala Avatar asked Nov 29 '25 09:11

David Rz Ayala


1 Answers

Try this...

ERB.new(@template.source).result

ERB#new

like image 55
Kyle Avatar answered Dec 02 '25 02:12

Kyle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!