Questions tagged [eruby]

eRuby is a templating system that embeds Ruby into a text document. It is popular in HTML documents.

eRuby allows to write Ruby code enclosed by <% and %>. The embedded code blocks are evaluated in-place (and replaced by the result of their evaluation).

36 questions
47
votes
7 answers

Should I use haml or erb or erubis for potentially high traffic site?

I have been playing with Haml recently and really like the way the resulting code looks to me...the developer. I'm also not too worried about a designer being able to consume or change it...we're a small team. That said, beginning work on a project…
John Wells
5
votes
3 answers

Which to use, eruby or erb?

What's the difference between eruby and erb? What considerations would drive me to choose one or the other? My application is generating config files for network devices (routers, load balancers, firewalls, etc.). My plan is to template the config…
Brent Chapman
  • 2,519
  • 3
  • 20
  • 10
4
votes
2 answers

Ruby error "Superclass mismatch for for class Cookie" from cgi.rb

I've just updated my ruby installation on my gentoo server to ruby 1.8.6 patchlevel 287 and have started getting an error on one of my eRuby apps. The error given in the apache error_log file is: [error] mod_ruby: /usr/lib/ruby/1.8/cgi.rb:774:…
robintw
  • 27,571
  • 51
  • 138
  • 205
3
votes
0 answers

nXhtml (No javascript-mode/eruby-javascript)

I've just installed nXhtml by downloading their zip file, extracting the archive into my home directory and adding (load "/home/spinlock/nxhtml/autostart.el") to my .emacs file. My problem is that when I try to edit a .js.erb file, I'm getting the…
spinlock
  • 3,737
  • 4
  • 35
  • 46
3
votes
2 answers

rhtml (eruby) apache trouble

I am trying to run embedded ruby inside rhtml. $cat test.rhtml Testing <% foo = "Ruby"; print "#{foo}!" %> It works fine from the command line: $eruby test.rhtml Testing Ruby! But…
user414585
  • 715
  • 2
  • 8
  • 14
3
votes
0 answers

How to use partial views using the Erubis gem

I am not using Ruby on Rails, this is a stand alone app using the the erubis gem. I have a few template files which I use for generating a static website, and would like to separate the header, body, and footer sections in the files. For example <%=…
hak8or
  • 488
  • 2
  • 9
  • 28
3
votes
3 answers

printing in erb without '<%= %>' or ruby on rails

Similar to Print in ERB without <%=? However, the answer there is specific to ruby on rails. Is there a similar capability in vanilla erb? Here's a use case: <% [ 'host_perfdata_command', 'service_perfdata_command', ].each do |var| value…
Phil Frost
  • 3,668
  • 21
  • 29
2
votes
1 answer

Is it possible to define a constant in an eRuby template in Rails

Since I hate calling methods with boolean literals that don't say anything about their intent I tried defining a constant in my eruby template as follows: <% NO_NIL_PADDING = false %> for a call to in_groups_of. However this resulted in a dynamic…
Sam
  • 14,642
  • 6
  • 27
  • 39
2
votes
1 answer

Ruby Rendering Specific Variable

I have a template which contains various variables for rendering. Is there a way i can render specific variables in the template without exception. e.g. template_content = "My name is <%=firstname%>. I live at <%=location%>" variable_hash =…
abrocks
  • 171
  • 13
1
vote
2 answers

Under what cirumstances would I need eruby if I'm just doing Ruby programming

As I understand it, eruby is like erb - it lets you stick ruby code into HTML. If someone is using Rails, more than likely they would use erb or Haml. But if I'm not using Rails, under what cirumstances would I need eruby if I'm just doing Ruby…
Bryan Locke
  • 2,337
  • 5
  • 25
  • 30
1
vote
1 answer

Problem connecting to MySQL with eRuby

I'm having a problem connecting my eRuby scripts to my MySQL database. I've written a short test script just to work out the initial connection bugs: <% require 'mysql' begin dbh = Mysql::new("localhost", "test", "wahssf", "amg") rescue…
Derrick T
  • 21
  • 1
1
vote
2 answers

indentation ERB file

I have the following code: if (!EAP-Message) { # Now check against the authorized_macs file <%- @filename.each do |key,value| -%> <%= key %> if (!ok) { <%- end -%> eap } …
Max
  • 543
  • 6
  • 17
1
vote
1 answer

Apache2 & eruby, as 10 years ago

Why can't I use eruby without Rails ? I don't like Rails, but it seems eruby has not been used without Rails for a decade (If I refer on the dates of the lasts questions about eruby on Stack Overflow). Here are the lines that I added to my Apache…
Jingbee
  • 23
  • 4
1
vote
1 answer

Ruby 2.1 with erubis Template Engine

We are looking for fastest template engine for rendering of views. As i understand erubis is the fastest template engine in ruby. My usecase is render templates through script. Looking at the gem official page it's latest release was in 2011. Not…
abrocks
  • 171
  • 13
1
vote
1 answer

eruby on windows7

I was trying to search if I can install eruby on my windows7 machine but couldnt find anything. I could find how to install it on apache. But I want to install it on my win7 machine. I am hoping that I can use it by embedding it in HTML, like we…
user1207289
  • 3,060
  • 6
  • 30
  • 66
1
2 3