Skip to content

Let the templates generator generate 100% compatible Haml templates with the Rails' original ERB templates#197

Merged
amatsuda merged 19 commits intohaml:masterfrom
amatsuda:rails_versions
Sep 28, 2025
Merged

Let the templates generator generate 100% compatible Haml templates with the Rails' original ERB templates#197
amatsuda merged 19 commits intohaml:masterfrom
amatsuda:rails_versions

Conversation

@amatsuda
Copy link
Member

@amatsuda amatsuda commented Sep 27, 2025

Current haml-rails gem includes a set of templates (that are unmaitained for a decade) for generating Haml templates via rails g command, and I suppose some of them might be outdated and won't work on recent versions of Rails (like, recently reported on #196).

So, this patch introduces a new mechanism for the scaffold generator to switch the template templates per the currently running Rails' version.
Plus, actual template files for all supported Rails versions: i.e. 5.1, 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, 8.0.

For testing this approach, I added a new test case that generates scaffold templates for both ERB and Haml, then actually renders all of them on a real Rails app, then compares the rendered HTML results one by one.

@amatsuda amatsuda force-pushed the rails_versions branch 2 times, most recently from bd509c9 to 36256f2 Compare September 28, 2025 06:59
@amatsuda amatsuda merged commit 2c51fd5 into haml:master Sep 28, 2025
35 checks passed
@amatsuda amatsuda deleted the rails_versions branch September 28, 2025 07:51
@simi
Copy link

simi commented Mar 6, 2026

Hello, it seems the symlinks are causing troubles on non-unix platforms. ruby/rubygems#9296 Would it be accepted to provide PR removing symlinks and resolving the issue in different way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants