2,634 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
141
views
Adding a simple ERB template to the existing Rails scaffold process?
I can't seem to find a straight answer on this and AI is even leading me a stray. This is the closest post on this:
Overriding Scaffold Controller in Rails 7.1
In my app I have the standard *.erb.tt ...
4
votes
1
answer
209
views
Render a partial view outside controller
Context
I've written an internal standalone gem that generates PDF with Gotenberg rendering an ERB HTML template dynamically. This permits to actually generate a PDF outside a controller context for ...
0
votes
1
answer
79
views
Adding a line break in an .each do loop in an ERB file
I have code in an .erb file that loops three titles and descriptions from a corresponding YAML document. I would like to add a line break before the second and third titles as they all run together (...
0
votes
0
answers
45
views
Sinatra (erb) - construct link from select choice
I have a small sinatra app, which I am using primarily over REST (so far) to run and automate some data processing tasks (register new data sets, and then assign processing tasks etc). Anyway, to help ...
0
votes
0
answers
53
views
Inline AI code completion (codeium) for .erb files not working
it seems like codeium (windsurf) doesn't suggest code completion in .html.erb files, i tried to add this to my settings to associate erb to html
"files.associations": {
"*.html.erb&...
1
vote
1
answer
83
views
How to embed sub-templates in .yml.erb with <%= ERB.new(sub_template).result(binding) %>
I have the below parent.yml.erb:
template:
spec:
- image:
env:
- name: env_a
valueFrom:
...
- name: env_b
valueFrom:
...
...
0
votes
0
answers
35
views
Visual Studio Code "Format On Save" breaks code block formatting (Javascript inside ERB)
Codeblock inside Javascript breaks
I have following native code escape blocks inside ERB file
let hide_registration = <%= @user.skip_registration? %>
After I hit save, it gets formatted like ...
0
votes
1
answer
62
views
Replacing if in ERB with a method
I want to replace this code
---
myyaml:
me:
:name: "John"
text: |
My name is <% if me %><%= me[:name] %><% end %>
---
With something like this:
---
myyaml:
...
0
votes
1
answer
95
views
How can I combine all elements of a div into a static image before printing?
I've inherited a project so there's a lot of javascript and jquery going on that I don't understand the original intent, so please bear with me with any followup questions.
I have a tool where you can ...
0
votes
1
answer
68
views
Insert after closing ERB tag with spree/deface
there is a project called TheForeman (v3.3.0) for which I want to override some ERB templates with spree/deface (v1.5.3), for example _managed.html.erb, and add something at the end of it.
# in app/...
0
votes
1
answer
250
views
Unexpected Error Diagnostics for erb files
My current neovim (lazyvim) show weird errors for my .erb files.
How can I find out which linter is showing them to me in order to configure it correctly?
My linter for ruby are
erb-lint for erb
...
1
vote
1
answer
259
views
How to make ERB or ERUBI escape HTML in the template without escaping the entire template - NOT RAILS
I'm using ERB or ERUB or Tilt here outside of Rails and I want to make my HTML templates work like rails where stuff is HTML escaped by default.
e.g.
<!-- file.html.erb -->
<h1>Hello <%=...
1
vote
1
answer
109
views
Rails: Form that sets up default values for an object?
Say I have an object that has some attributes with default values. I set up the default values for these attributes at a model level like so...
after_initialize :set_defaults
def set_defaults
...
1
vote
0
answers
183
views
Why Tailwind CSS doesn't works with public/*.html files in my Ruby on Rails project
I'm using Tailwind CSS for my Ruby on Rails project, the CSS works fine with all the layouts in views but it doesn't works with public/*.html files in my project.
I have a 404.html page and a 500.html ...
1
vote
1
answer
148
views
Why do Ruby ERB if statements set variables to nil?
I'm using ERB to generate a set of instructions with location data, and want to accept an offset in my input. When I try to check if that offset is present however, it sets it's value to nil. If ...