Feature #1064
closedUsing erubis instead of builtin ERb
0%
Description
I've been testing erubis in place of the regular ERb templating system and it works fine with both RadiantCMS and Redmine. Thus it would be interesting to at least mention the possibility somewhere. What I'd also suggest is to put the following two lines at the end of config/environments/production.rb:
- Uncomment to use erubis instead of builtin Erb
- require "erubis"
Updated by Jean-Philippe Lang over 16 years ago
Simply adding require "erubis"
doesn't seem to have any effect, at least with Rails 2.0.
I had to follow this to enable erubis:
http://railspikes.com/2007/12/10/rendering-erubis-and-rails-2-0
it works fine with both RadiantCMS and Redmine
I can not get Redmine running with erubis 2.5.0 and Rails 2.0.2.
I get a 500 error on home page:
... Rendering template within layouts/base Rendering welcome/index ←[4;35;1mSetting Load (0.000000)←[0m ←[0mSELECT * FROM `settings` WHERE (`se ttings`.`name` = 'welcome_text') LIMIT 1←[0m ERROR: compiling _run_erubis_47app47views47news47_news46rhtml RAISED compile err or H:/trunk_fix/app/views/news/_news.rhtml:1: syntax error, unexpected kUNLESS_MOD, expecting ')' _erbout = _buf = ''; _buf << '<p>'; _buf << Erubis::XmlHelper.escape_xml( link_t o(h(news.project.name), :controller => 'projects', :action => 'show', :id => new s.project) + ': ' unless @project ); _buf << ' ^ H:/trunk_fix/app/views/news/_news.rhtml:3: syntax error, unexpected kIF_MOD, exp ecting ')' '; _buf << Erubis::XmlHelper.escape_xml( "(#{news.comments_count} #{lwr(:label_c omment, news.comments_count).downcase})" if news.comments_count > 0 ); _buf << ' ^ H:/trunk_fix/app/views/news/_news.rhtml:3: syntax error, unexpected ')', expecti ng kEND '; _buf << Erubis::XmlHelper.escape_xml( "(#{news.comments_count} #{lwr(:label_c omment, news.comments_count).downcase})" if news.comments_count > 0 ); _buf << ' ...
I think it's caused by inline statements.
Can you tell which Rails and erubis versions you're using ?
Updated by Jean-Philippe Lang over 16 years ago
- Status changed from New to Closed
- Resolution set to Invalid
Reopen if you have some feedback on using erubis.
Updated by ChunChang (Nagaharu) Lo over 16 years ago
I have used Erubis for few weeks, everything works fine.
My system configuration: fc9, ruby 1.8.6, ror 2.0.2.
The steps I took to replace erb:
- install erubis with rubygem
# gem install erubis Successfully installed abstract-1.0.0 Successfully installed erubis-2.6.2 2 gems installed
- modify config/environment.rb, add:
require 'erubis/helpers/rails_helper' #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby #Erubis::Helpers::RailsHelper.init_properties = {} #Erubis::Helpers::RailsHelper.show_src = nil #Erubis::Helpers::RailsHelper.preprocessing = false
- modify config/environments/production.rb, add:
# Uncomment to use erubis instead of builtin Erb require "erubis"
Updated by ChunChang (Nagaharu) Lo over 16 years ago
forgot to mention that i have uncommented the last line in step 2, ie:
Erubis::Helpers::RailsHelper.preprocessing = true