I'm currently upgrading my rails app to 7. I was just testing it for a while then I have issues on Foundation Rails. I installed it and followed all the steps except the
Add Foundation to your JS
It seems the instruction is not updated yet for rails 7.
As a result, the CSS seems to work alright but when trying to implement features that require javascript like Reveal, it won't work properly.
Any idea how to implement Foundation to Rails 7 properly?
It's dead, Jim.
The foundation-rails gem like almost all "gemmified assets" is made for the old Sprockets assets pipleline that was the default in Rails 5 and its not maintained or relevant in modern versions of Rails.
The whole idea of wrapping third party JavaScript or CSS packages in Ruby gems was a considered an accepatble solution back when Sprockets was originally introduced but has not aged well as its dependent on maintainers updating gems just to push new versions of the front-end package.
Development on Sprockets itself has also stopped and it may not even be able to compile modern versions of Foundation if it uses newer features like the module system thats only available in Dart-Sass.
Rails 6 replaced Spockets with the short-lived Node.js based Webpacker. Rails 6 also defaulted to using Yarn to install front end packages from NPM.
Rails 7 takes a very different approach:
Rails 7 isn't shipping with a single answer to how to manage front-end packages.
Instead it just has the plumbing to hook up a variety of systems and you need to find the system that works for your requirements such as linking to CDN's via import-maps, jsbundling-rails or (shudder) downloading foundation and compliling it via something like Scout.
In terms of developer convience is it a huge step back from the Rails 5 days when it "just worked" (kind of) but that approach was no longer tenable.