erb

Is there any way to use the command line to debug an ERB file?

Is there any way to use the command line to debug an ERB file? I would like to know if there is any way to get rdebug or rdebug-ide to do this. ...

ERB tag within link_to_function javacript call

I need to dynamically set which id a javascript call uses, as I have multiples rendered on each page, I'm trying to use <p id="add_rider_link_section_<%= section.id %>"><%= link_to_function("Add a Rider", "Element.remove('add_rider_link_section_' + <%= section.id %> + '' ); Element.show('add_rider')") %></p> It's failing on "Element....

Yield in view for multiple blocks

I am writing a small Sinatra-based app and would like each view to be able to insert various items into the layout, for example the page title or extra CSS/javascript references in the head. Currently my layout (erb) looks like this (simplified): <html> <head> <title>Hard Coded Title Here</title> <link rel="stylesheet" ... /> <...

Rails, jQuery, .js.erb files, JS not executed by the browser.

I'm trying to use jQuery, and everything has been great, until now, when I'm trying to render a partial and append it to a div. Here is how I have it set up: I have an action that responds to js: def index @objects = Object.find(:all) respond_to do |format| format.js end end And a template called index.js.erb with some jav...

Ruby on Rails: How to gather values for child tables from a form?

Referencing question #2013421, I have the following RoR models: class Game < ActiveRecord::Base has_many :piles end class Pile < ActiveRecord::Base belongs_to :game end For the sake of argument, suppose Game has an attribute name, and Pile has an attribute type, both string. There are precisely 10 piles per game. I would like a ...

alternatives for erb to make application.js dynamic

To make application.js more dynamic, I create javascript_controller and rename public/application.js to app/views/javascripts/application.js.erb But <%= … %> does not look very good in javascript, are there any better templating engines for this task? ...

Formatting ERB Templates automatically in textmate

When writing ERB templates in Ruby on Rails using Textmate formatting by hand pretty much sucks. Do anyone know of a textmate bundle that handles formatting of ERB templates/views? My googling has found nothing. Thanks! ...

Ruby ERB not reflecting changes

I'm trying to change an ERB to remove the line <div id="header"></div> However, the resulting div tag still appears on the page, even 30 minutes after the fixed file was uploaded to the server. The server is running Ruby 1.8.6 and Rails 2.1.2, and the affected files (two_column.html.erb and three_column.html.erb) were downloaded from...

Who Creates Custom ActionMailer Layouts in Rails, You or the Client?

When projects get large, I imagine you might start having 100s of mailer templates: user_signup_confirmation.html.erb user_signup_failure.html.erb user_account_activation.html.erb user_account_cancelation.html.erb ... What is your workflow for handling this? Do you have them email you what they want and then you mold it into a metho...

Cannot display variable from controller in erb file

Hi, I begin learning ruby and rails this week. So I follow some tutorial in the book I found in my school library. I get to the point where I have main_controller.rb: class MainController < ApplicationController def welcome @my_var = 5 end end and for my welcome.html.erb: <h1>Welcome to the My Application</h1> We currently h...

rails / erb bug or feature

just transfered an old rails application (1.1.6) to a new host providing a passenger/enterprise ruby environment. one of the programmers used ruby tags to comment html content and this seems to cause some trouble on the new host. an example: <div> <% collection.do_domething %> ... <% end %> <% # finished showing content %> </div> <div>...

how to use an array in form_for?

I've got a user model which contains a field called, lets say, text1. In the users/new form I want to have 4 individual text boxes for this text1. In my model I will take values from these boxes and concatenate them together as comma separated values and store them in the DB. To give you an understanding, this is what I want. <input typ...

Check if Javascript is Enabled (Serverside) with Rails

How would you check if javascript is enabled in Rails? So that I could do something like this in the views: <div> <% if javascript_enabled? %> <p>Javascript Enabled!</p> <%- else -%> <p>No Javascript</p> <%- end -%> </div> ...

How do I escape ERB code in fixtures?

Hi, I have a simple fixture.yml label: body: "<%= variable %>" The issue is that the erb code is parsed as part of loading the fixture, but I actually want to body to be "<%= variable %>" un-interpolated. How do I escape this? -daniel ...

Custom ERB tag replacement

How can I get ERB to replace tags in a format other than <%= %> for example: {{ }} Thanks ...

Can I inherit an erb template?

Is there any way to have a template inherit another template? I'm not using Rails. ...

undefined method error appears in erb but not haml

Hey all, All I wanted to do was convert a haml file to erb. After doing so, i get an undefined method `render_sequence_nav' error message. Even though no such error happened when it was in haml format. In the haml file, there is this line: #fields << render_sequence_nav(sequence_info, students_path) fields << render(:partial => ...

Loading association data from database into edit.html.erb

I have the following one to many associations. Document has many Sections and Section has many Items. class Document < ActiveRecord::Base has_many :document_sections, :dependent => :destroy, :autosave => true has_many :document_items, :through => :document_sections end class DocumentSection < ActiveRecord::Base belongs_to :docume...

Problem with Rails ERb rendering?

A very simple HTML in my .erb file: <a href="javascript:void(0)" id="xyz">Click</a> But when browsing this code in the browser, I get the link which text is: Click (javascript:void(0)). Could you please help me explain why it is? Thanks much for your help. My development environment: Ruby 1.8.7 Rails 2.3.4 ...

yield in ERB without rails

Hi How can I use yield for template inheritance in erb? I want to use erb in a plain ruby CGI script and want to use a base template and subtemplate like it Rails with the application template does. ...