Took a while to sort this out, so it would be nice to add something to the read me.
In a Rails 5.2 project I previously had just
gem 'haml_rails'
in my Gemfile, it was happily generating haml for new views. But I didn't have the erb to haml converter so I upgraded to
gem "haml-rails", "~> 1.0"
Which provided the utililty to convert my application layout to haml. But it also completely busted view generation so that when I scaffold a new model I now get this error
Could not load generator "generators/haml/scaffold/scaffold_generator". Error: uninitialized constant
Haml::Rails::Generators.
I commented out the line in config/application.rb
config.generators do |g|
g.template_engine :haml
which was there before when I was just using gem 'haml_rails' as the newer gem "haml-rails", "~> 1.0" shouldn't need it (that's the main point of the updated gem). But was still broken.
Finally after a lot of head scratching and wasted time I realised that haml-rails might not be a direct descendent of haml_rails and simply doesn't upgrade cleanly. So I had to remove 'haml_rails' from my installed gems and remove the lib/generators directory which had haml templates and generators in it.
It now works, but.. that lib/generators was incredibly useful because it had templates I could edit to get new views as I wanted them. e.g form_with or boostrap_form_with.
It would be nice to take the code for templates from haml_rails, an old dead project, and use it in haml-rails so that users could have editable templates.
Took a while to sort this out, so it would be nice to add something to the read me.
In a Rails 5.2 project I previously had just
in my Gemfile, it was happily generating haml for new views. But I didn't have the erb to haml converter so I upgraded to
Which provided the utililty to convert my application layout to haml. But it also completely busted view generation so that when I scaffold a new model I now get this error
I commented out the line in config/application.rb
which was there before when I was just using
gem 'haml_rails'
as the newergem "haml-rails", "~> 1.0"
shouldn't need it (that's the main point of the updated gem). But was still broken.Finally after a lot of head scratching and wasted time I realised that
haml-rails
might not be a direct descendent ofhaml_rails
and simply doesn't upgrade cleanly. So I had to remove 'haml_rails' from my installed gems and remove the lib/generators directory which had haml templates and generators in it.It now works, but.. that lib/generators was incredibly useful because it had templates I could edit to get new views as I wanted them. e.g
form_with
orboostrap_form_with
.It would be nice to take the code for templates from
haml_rails
, an old dead project, and use it inhaml-rails
so that users could have editable templates.