Skip to content

Conversation

@Jeremy-Walton
Copy link
Member

Why?

When using the rails scaffolding commands, it would be nice to auto generate templates already set up to use slim and Optics.

What Changed

  • Fix generated files that were referencing the logo
  • Fix The ui components rolemodel:ui_components:all command
  • Remove Tailored Select from rolemodel:all command
  • Fix devise enum syntax
  • Fix incorrect button classes in various templates
  • Add scaffold template files to slim generator
  • Update scaffold template for form in simple form generator

Pre-merge checklist

  • Update relevant READMEs
  • Update version number in lib/rolemodel_rails/version.rb

Video Demo

Video

Copy link
Member

@OutlawAndy OutlawAndy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, @Jeremy-Walton! Thanks!

I think it would be worthwhile to add a bit of documentation to the slim generator explaining where to find the scaffold templates so they can be customized to your applications designs.

<%% @<%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
div = link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %>
<%% end %>
<% else -%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to take rich text into account here and in the form

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied the default rails scaffold and adapted to slim. https://github.com/rails/rails/blob/main/railties/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt

Could be a future improvement

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My expectation is that every project is going to want to customize these templates immediately. But also that over time with lots of use, we'll find commonality to upstream.

@Jeremy-Walton Jeremy-Walton merged commit ddf2eeb into master Nov 13, 2025
2 checks passed
@Jeremy-Walton Jeremy-Walton deleted the add-scaffold-templates branch November 13, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants