-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit module nesting #2532
base: main
Are you sure you want to change the base?
Explicit module nesting #2532
Conversation
8bd32b6
to
f501f90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The need to add a lot of <%= indent %>
, isn't sitting well with me, but I can't think of an alternative. What else did you try?
The way I tried: First I split the template into 3:
Then I used ERB, passing in This did not work. The Unfortunately I did not find another way to generate 3 templates and then stitch them together. |
Interesting, thanks! I'd like to play around with it a bit, I think. @pablobm, do you have any thoughts on this implementation? I'm really not sure what to suggest here. |
Yeah, the internals of Rails templates are not easy to work with... 😓 Something that might work though: how about generating the three files (head, body, foot) and then editing and merging them using normal |
@pablobm tpl = ERB.new(File.read('whatever.erb'))
result = template.result(binding) This will fail with errors related to missing methods. Binding does not have the same access that Having the indents added in every line of the template is the only thing I could do to make it work. |
Initial draft of explicit module nesting.
Please take a look and tell me if you're OK with this approach before I convert the controller template as well.
My initial plan to split the template in 3 an add the indentation programmatically instead of editing every line in the template failed as I could not find a way to do it with Rails' own functionality and manual erb templates I tried were giving me weird errors when passing in
binding
to the template. So I decide to do it the brute force way.Dockerfile will be deleted before merge.
Please don't merge this in until #2495 is merged as I have to modify the code to make it compatible.