Hi
i have:
<a href="/patients/#{@appointment.patient.id}">
<%=h @appointment.patient.f_name %> <%=h @appointment.patient.l_name%>
</a>
but it dose not work due to a syntax error, if i click on the href it goes to http://0.0.0.0:3000/patients/#{@appointment.patient.id}
thanks
...
I've got a Ruby on Rails app where I do the following:
@user = User.find(:first, :conditions => ['LOWER(username) = ?', current_subdomain.downcase], :include => :bio)
Where ':include => :bio' is the important part.
Then in the view I want to display some bio:
<em><%= @user.bio.title %></em><br />
<%= @user.bio.city %><br />
<%= @us...
I have a quite average form in Rails, trough blog_kit
<% form_for(@blog_post, :html => { :multipart => true }) do |f| %>\
... other code
<%= f.text_area :body %>
<%= debug(@blog_post) %>
When editing a blog-post, the body suddenly contains additional spaces (marked as _ to visualise):
...sit amet eleifend diam imperdiet pharetr...
Until a week ago I was happily coding html.erb files in Notepad++ with syntax highlighting. Then my hard drive crashed.
I reinstalled Notepad++ on my new system but when I open my html.erbs, only a few of them are highlighting properly.
I think the problem might be that most of these files are being considered 'normal text files', whe...
I have some trivial markup that looks like the following:
<li class="someclass">
<=% t'model.attr' %>
</li>
Is there a trivial way to comment that out? Just wrapping <!-- --> around the block will still leave the ruby code available to the template. This means I have to comment out the HTML and Ruby specific code separately.
What's...
My goal is to highlight <basename>.<extension>.erb files as I would highlight <basename>.<extension> files.
As a first pass, I'm fine with supporting <basename>.<filetype>.erb, which I tried to do with
au BufNewFile,BufRead *.erb setf <afile>:r:e
But this doesn't seem to be working. What should I be doing?
...
Hi guys
I have a select input on my page. this select input displays/hides fields in the form. This all works fine. But the problem is that if i submit the form and lack some necessary fields, it doesnt set the select to the right value afterwards. I just cant get the embedded ruby to work! it keeps escaping the whole thing... here my c...
How can I print data, usually html, in erb? Sometimes it is just impossible to do everything in the controller, like so
print "you are funny" in a red div, with a big structure
and
print "you are hilarious" in a blue div with simple structure
I cannot store them in a variable in the controller n then print it in erb
and the <%= %> ...
In Rails 3, when a scaffold is generated for instance for a 'Category' the will be a categories_path (and a edit_category_path(@category), ...) used in the erb views.
This is not a variable that can be found anywhere and probably is generated. However in my case, for a different entity, Article, I first generated the model and then the ...
How would you port this front-end logic from erb to jsp/jstl?
<%= error_messages_for :foo %>
Is there any Java library that does something similar?
...
I want to render an HTML-EMail and send it to our customers using some ERB Templates.
The basic code I am using:
ERB.new("newsletter.html.erb").result(binding)
doesn't allow me to add partials to the html.erb-File. I would love to move the header and footer to a partial and use the render :partial-Method in that call.
Is this possib...
I'm a big Haml/Sass fan. Right now I work with a designer who prefers Erb and doesn't speak Haml.
I find that working with Erb is slowing me down considerably, and it doesn't seem fair that he should have to pay for that time (he's the client & I'm paid hourly).
The erb->haml converter works quite well these days, but I don't know if t...
Hi guys,
I'm using Rails 3. I want to display generated html fragment inside erb template
<%= "<div>Foo Bar</div>" %>
Rails encodes div tags.
If I'm correct in Rails 2 <%=h cause encoding. Seems that it was changed in Rails 3. How can insert html fragment without encoding in Rails 3?
Regards,
Alexey.
...
I have a nested hash:
{
:KeyA => {
:KeyB => "hello",
:KeyC => {
:KeyD => "foo",
:KeyE => "bar"
}
}
}
if I pass this to ERB I can do:
<%= config[:KeyA][:KeyC][:KeyD] %>
and get:
foo
However this doesnt work with Liquid :(
If I do:...
Can embedded ruby (erb) be used outside of rails in regular webpages to dynamically update content (almost as a replacement for PHP)?
...
Rals 3.0
My question is using link_to_remote to make an ajax call.
2.3.8 Ajax call
<%= link_to_remote image_tag("../images/services_button.jpg", :mouseover =>
"../images/services_button_over.jpg"), :url =>{:controller => :dashboard, :action => :service} %>
Current View -
<% link_to_remote view_path do %>
About Us<s...
I'm just getting started with Ruby and Ruby on Rails, so excuse me if this is a simple question. I've noticed that in some ERB files, there is a difference to using <%= %> and <% %>, but what is the difference?
Thanks!
...
in ruby you can do conditional block like so
block do |n|
puts n
end if foo == bar
which would translate into erb as
<% block do |n| %>
<%= n %>
<% end if foo == bar %>
is there a way to achieve this in haml other than wrapping the block in a condition?
...
I have no trouble making typical AJAX calls to and from Rails(3) with JSON objects and jQuery-rails (jQuery library plus a special rails.js file).
In one controller, though, I want to RETURN some JSON in an erb template (create.js.erb) after an AJAX call.
I've tried every combination of things in the controller (@object.to_json, '[{"co...
Whenever I make a open or save and erb file. I get this error. No idea how to fix it
Error detected while processing function <SNR>59_UpdateErrors..<SNR>59_CacheErrors..SyntaxCheckers_eruby_GetLocList..SyntasticMake:
Line 20:
E40: Can't open errorfile ~\AppData\Local\Temp\VIeF751.tmp
...