Displaying 20 results from an estimated 10000 matches similar to: "printing in middle of an erb file"
2004 Feb 24
1
Accessing columns in data.frame using formula
Hello!
I'm trying the hard way to use a formula, in a function, to specify the
names of several important columns in a data.frame. Maybe I'm just battling
to figure out the right search terms :-( This is on XP, R 1.8.1.
So, for instance,
wery[1:5,]
V1 V2 V3 V4 V5 congr V7 V8 V9 ok RT
1 1 1 960 520 1483 c 1 r r 1 760
2 1 2 1060 450 3753 c 1 r r 1 555
2006 Feb 20
7
Native erb lacks -%>, where is Rails'' erb?
Native ERB in ruby, and eruby, seem to lack the -%> feature for
suppressing trailing newlines. Thus
erb -n script
gives errors. Where is Rails ERB so I can invoke it directly?
Thank you
Hugh
2007 Jan 19
4
Rendering with erb
Hi, I thought it would be fun to try to write a render method that
uses erb for rending. I''m not much of a programmer, but I still like
to try:
module Test
require ''erb''
def render(m)
ERB.new(IO.read("templates/layout.html")).result(binding) do
ERB.new(IO.read("templates/#{m}.html")).result(binding)
end
end
end
This
2006 Jul 25
3
about ERB sample
Hi list:
I run the ri''s ERB doc 1st sample
1. require ''erb''
2. x = 42
3. template = ERB.new <<-EOF
4. The value of x is:
5. EOF
6. puts template.result(binding)
the doc say it will print
"The value of x is: 42"
but my irb print "nil" and there is a
"=> #<ERB:0x2970b24
2006 Sep 01
5
templates and require
Thanks everyone for your quick responses to my questions.
I''m trying to get templates working. I want to pull the template down
from the puppet server, then use it. It looks like the require
parameter is not being enforced when using the content parameter so the
template can''t be found.
This doesn''t work:
file { "/etc/lighttpd/lighttpd.conf" :
2011 Mar 09
1
" instead of " in js code rendered by erb
Having problems rendering javascript in erb file. Thanks for
suggestions.
//layout erb file
(function() {
...
var widget_properties = {};
<%= content_for?(:extend_widget) ? "widget_properties = " +
yield(:extend_widget) : '''' %>
...
})();
//view erb file
<% content_for :extend_widget do %>
extend = {
_init: function() {
2006 Apr 25
5
markaby or erb?
Guys,
We''re embarking on a new dev project, and I''m curious....why would one
choose markaby over erb? I for one am no fan of the erb syntax, but
aside from that it''s similar to other technologies I''ve used in the
past: PHP, JSP, ASP, etc.
Why would one choose markaby over erb? What are the benefits? What are
the drawbacks? Is there anything remarkable
2007 Sep 28
2
RoR uses something rather than erb or eRuby?
it seems that RoR doesn''t use erb or eRuby to generate its output for
rhtml?
the program erb and the description of eRuby at
http://www.eruby.info
both said that
<% print "foo bar" %> or <% puts "hello" %>
will be placed into the output...
but currently for RoR, it won''t...
only <%= expr %> is doing it and it cannot be print or
2011 Oct 12
4
How to access controller's instance variable in a js.erb loaded by javascript_include_tag?
Hello!
In rails 3.1 app I have a controller UsersController with ''show'' action.
show.html.erb contains:
<% content_for(:head) do %>
<%= javascript_include_tag ''myscript'' %>
<% end %>
<p>Hello @user.name</p>
And I have this in myscript.js.erb
$jQuery(document).ready(function() {
alert(<%= @user.name %>);
});
@user is being
2007 Oct 06
4
Passing ERB block to helper
I''m trying to pass an ERB block to a helper, and I''m not able to achieve
the results I want. The helper should take the block and incorporate it
into some other text & html, before finally outputing it back to the ERB
template.
Here''s what I want:
--helper--
def helper (a, b)
yld = yield
out = --some function of a, b, and yld--
out
end
--ERB--
<%
2012 Apr 24
3
How to increment variable in erb template ?
Hi'',
I''m looking for a way to increment variable in template (erb file).
I tried this, but it didn''t work
Compteur <%= compteur %>
> <% compteur = compteur + 1 %>
> Compteur <%= compteur %>
>
I''ve got this error :
> Error 400 on SERVER: Failed to parse template test/test.erb: undefined
> method `+'' for
2006 Mar 15
3
Special characters in ERB
I''m pulling text out of a database that contains special characters,
like the trademark sign. For example, a typical string might be like this:
string_from_database => "Some Special Brand\231 is for sale this
Thursday through Friday."
The \231 is the trademark sign (TM). ERB converts this to question
marks. So, my question is -- how can I get it to display the trademark
2012 Nov 27
1
controller not rendering existing js.erb file
In my PlaceController, I have a search method, called remotely from a form
the method is executed, but rendering is not executed as the template is
stated as missing ..
but it''s there ...
post :search, :locale => I18n.locale, :format => :js, :country =>
"United"
Error: test_should_search_places(Backoffice::PlacesControllerTest)
ActionView::MissingTemplate:
2007 Apr 03
4
Replacing ERB with Erubis
Hey guys,
I''ve been hearing a lot about erubis: http://www.kuwata-lab.com/erubis/
Especially about how much faster it is than straight ERB.
In their Ruby on Rails support docs: http://www.kuwata-lab.com/erubis/users-guide.05.html#topics-rails
They state that with a few added lines to your environment.rb it will
replace ERB completely.
I''m wondering if anyone has done this in
2006 Feb 07
4
__END__ equivalent for erb?
Time and time again I find the need to terminate evaluation of an erb
file on a certain line for debugging purposes, but can''t figure out a
way to do it. Is this possible?
Thanks!
John
--
Posted with http://DevLists.com. Sign up and save your time!
2008 Apr 12
1
index.html.erb
Hi Everyone,
A newbie question, I have my subdomain pointing to th respective
app/views folder however the browser does not default to the
index.html.erb , so instead I just have file listing. When I click on
the index.html.erb it does work fine. What do I need to do to get it to
work so it automatically load when a user goes to that view folder.
Thanks in advance
Using ROR 2.2
--
Posted
2006 Jun 27
5
Can''t call public application.rb method from ERb template
All,
I have a left navigation partial that I want to dynamically generate CSS
classes for based on the current controller action.
In my ERb template, I have
<DIV class="<%= get_menu_display_style(''login_form'') %>">
In application.rb, I have the method get_menu_display_style defined as:
public
def get_menu_display_style(action_requested)
2006 Jan 22
9
ERROR: undefined method `h'' for ERB::Util:Module
ERROR: undefined method `h'' for ERB::Util:Module
i get above error when i use
ERB::Util.h(content)
in my controller''s action.
can any one one tell me how to use this ''h'' method within controller?
thanks,
Jigar Gosar
http://jigar.org
--
Posted via http://www.ruby-forum.com/.
2008 May 27
1
syntax highlighting for .erb files
hi i am using radrails for ruby on rails development.I am creating
html.erb for my application.i have noticed syntax is not highlighting
for html.erb
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2008 Jul 08
1
Processing config files as ERB templates
For various reasons it''s very handy for us to process our mongrel cluster configuration files as ERB templates during start up. I found a post from a couple of years ago on this mailing list about possibly adding that feature. But nothing seemed to come of it.
I''d like to submit a request for this feature to be added, but I can''t figure out how to go about it. Is this