We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For example, this is my current new.html.erb:
new.html.erb
<%= render 'account/shared/page' do |p| %> <% p.content_for :title, t('.section') %> <% p.content_for :body do %> <%= render 'account/shared/box', divider: true do |p| %> <% p.content_for :title, t('.header') %> <% p.content_for :description, t('.description') %> <% p.content_for :body do %> <%= render 'form', tangible_thing: @tangible_thing %> <% end %> <% end %> <% end %> <% end %>
This is great because it plays on the natural language of Rails partials, but...
Is there a place for a shorthand like this when invoking a nice partial?
<%= render 'account/shared/page' do |p| %> <% p.cf :title, t('.section') %> <% p.cf :body do %> <%= render 'account/shared/box', divider: true do |p| %> <% p.cf :title, t('.header') %> <% p.cf :description, t('.description') %> <% p.cf :body do %> <%= render 'form', tangible_thing: @tangible_thing %> <% end %> <% end %> <% end %> <% end %>
This isn't un-Railsy, given how often content_for is invoked. I mean, we have t as an example of this sort of shorthand in Rails.
content_for
t
Is it ugly/confusing/undesirable to go full magic like this? Reminds me a little bit of FactoryBot's syntax/DSL.
<%= render 'account/shared/page' do |p| %> <% p.title t('.section') %> <% p.body do %> <%= render 'account/shared/box', divider: true do |p| %> <% p.title t('.header') %> <% p.description t('.description') %> <% p.body do %> <%= render 'form', tangible_thing: @tangible_thing %> <% end %> <% end %> <% end %> <% end %>
The text was updated successfully, but these errors were encountered:
andrewculver
Successfully merging a pull request may close this issue.
For example, this is my current
new.html.erb
:This is great because it plays on the natural language of Rails partials, but...
Potential Suggestion 1
Is there a place for a shorthand like this when invoking a nice partial?
This isn't un-Railsy, given how often
content_for
is invoked. I mean, we havet
as an example of this sort of shorthand in Rails.Potential Suggestion 2
Is it ugly/confusing/undesirable to go full magic like this? Reminds me a little bit of FactoryBot's syntax/DSL.
The text was updated successfully, but these errors were encountered: