erb Questions

2

I'd like to lint the files in my rails project (ideally, in my editor while making edits) via eslint, but I am currently unable to lint files that are pre-processed with ERB. How can I include *.j...
Snowber asked 10/6, 2015 at 5:16

3

Solved

<div class='row'> <%= form.field_container :name do %> <%= form.label :name, raw('Name' + content_tag(:span, ' *', :class => 'required')) %> <%= form.text_field :name, :c...
Pepe asked 28/6, 2013 at 21:55

8

Solved

How do we add comments in erb files, if we do not want them to be generated into the html content?
Scorpion asked 5/5, 2010 at 15:57

14

I got a problem with leaflet. Everything is working fine in development, but in production, my app isn't able to locate the marker-icon.png and marker-shadow.png images. It is looking for the pat...
Thorpe asked 14/12, 2016 at 13:52

1

I am trying to add Markdown support in Rails 7.1.1 app. Redcarpet gem version is 3.6.0. I follow advice from this question: Using ERB in Markdown with Redcarpet My current code (in /config/initiali...
Cold asked 25/11, 2023 at 19:21

10

Solved

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 ...
Momently asked 5/8, 2010 at 19:1

3

Solved

I'm just building a test suite for a legacy Rails app. The simplecov gem has been great for finding dark corners of the app which need test coverage (or which may be completely unused and OK to rem...
Duff asked 23/10, 2012 at 12:56

4

I have many html.slim files that I would like to convert into html.erb files since I am not familiar with the slim syntax. Is there a converter for slim to erb? I found a converter for html to sli...
Darlleen asked 24/4, 2014 at 18:55

3

Solved

Trying to convert *.html.slim views to *.html.erb. I've looked at these two questions: How can I convert html.slim to html.erb? - getting uninitialized constant when called from the console How c...
Chokecherry asked 5/8, 2015 at 15:50

1

I'm converting multiple html.slim files to html.erb. After following plenty of brilliant advice and tips on stack overflow, I'm pretty much done, but I'm not happy with the html.erb code that is ge...
Scroop asked 19/7, 2016 at 7:38

5

Solved

I need to render another controller action <%= render "controller/index" %> and i get this error Missing partial controller/index with {:formats=>[:html], :locale=>[:en, :en], :handlers=>...
Roseberry asked 18/5, 2011 at 22:28

3

Solved

I have the following entry in an erb template: # Lorem Ipsum... <% unless @foo['bar'] == nil %> <% @foo['bar'].each do |property, value| %> <%= "zaz.#{property} #{value}" %> &...
Humankind asked 26/2, 2018 at 10:6

2

Solved

I want to see live changes in browser if I edit .scss or .erb file in text Editor in Rails 4 + Ruby 2.0 project. I tried Guard and Guard-live-reload, but it's throwing the following error. 22:58...
Manifestative asked 19/7, 2014 at 17:28

3

I have a Global JSON variable in my Ruby on Rails controller. It looks like this @rails_side_json = { :name => 'Will', :age => 23 }.to_json I want this to be assigned to my javascript variable (v...
Watanabe asked 15/3, 2014 at 8:34

7

Solved

I tried :include_blank => true, but it didn't work. <select> <%= options_for_select Model.all.collect{|mt| [mt.name, mt.id]} %> </select> If I need to add it to the collect...
Acronym asked 15/7, 2011 at 17:32

7

Solved

Suppose I have the following string @x = "<a href='#'>Turn me into a link</a>" In my view, I want a link to be displayed. That is, I don't want everything in @x to be unescaped and ...
Drumfire asked 22/11, 2010 at 23:27

6

Solved

I don't like the way rails does page titles by default (just uses the controller name), so I'm working on a new way of doing it like so: application controller: def page_title "Default Title Her...
Matriarchate asked 1/10, 2010 at 16:51

3

Solved

I want users to type in Markdown text in a textarea and when they post it, I display the corresponding html. I read that Rails used to have a markdown method or similarly called method, that you co...

3

Solved

Writing a fully translated app can become tedious. Is there a way to set a default translation scope for the current context ? Example : I am writing inside a partial _deadlines.html.erb in the sh...
Ics asked 18/2, 2015 at 23:22

5

Solved

I have a RoR app using bootstrap. I'm trying to apply the fontawesome html icon tag to a submit_tag helper, but it does not seem to be supported. When I click submit, the disable content just appea...
Chapel asked 3/7, 2014 at 8:48

2

Solved

In Rails 5.2.3, I need to render a partial which takes an optional block. # users/_user.html.erb ... <% if block_given? %> <%= yield %> <% else %> <h1>Goodbye world</h...
Unmeet asked 22/10, 2019 at 19:24

3

Solved

How would you make an erb template that has human readable json? The following code works, but it makes a flat json file default.rb default['foo']['bar'] = { :herp => 'true', :derp => 42...
Flutter asked 26/6, 2015 at 23:15

5

Solved

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.
Bushnell asked 17/3, 2010 at 8:57

4

Solved

I am currently teaching myself some RoR and doing the tutorial, but adding some nicer layout and stuff with bootstrap and I am running into a problem which I cant figure out. I am trying to do the...
Limoges asked 8/8, 2013 at 21:40

3

Solved

What is the recommended use of ERb in Rails when it comes to <% %> (evaluate Ruby code), <% -%> (evaluate Ruby code, suppress the trailing newline) and <%- -%> (evaluate Ruby code...
Cyn asked 8/11, 2010 at 19:29

© 2022 - 2025 — McMap. All rights reserved.