How can I open a bundled gem with

On my local machine there was a fix with Devise that involved me opening up the bundled devise gem and editing the parameter_sanitizer.rb to accept paraments for my users. I have successfully deployed my app to but I’m unable to run “bin/bundle open devise”

How can I access this bundled gem with

Thanks in advance!

First, I’ll answer the question you asked, but then I’ll suggest what else you need to do:

fly ssh console
cd /app
bin/bundle open devise

Unfortunately what you change will get restored the next time you deploy, and restarting your server will take your vm down. So what you want to do next instead is bin/bundle show devise to find the path of the gem. Edit parameter_sanitizer.rb on your machine and copy it into your rails application. Then add a COPY parameter_sanitizer.rb <path> statement to your Dockerfile someplace after the # copy installed gems section, replacing <path> with the location of parameter_sanitizer.rb in your deployed devise gem.

Thanks for the quick response!

When I try to run bundle open devise it doesn’t open Visual Code Studio locally on my machine. What would I need to set my editor to with the ssh console?

The steps for the Dockerfile make sense, and I can implement those if I can figure out how to use the bundle open and bundle show in the ssh console.

I’m recommending that you do not run bundle open on the fly machine. Fly VMs are restored to a clean state every time your server restarts, so any change you make outside of volumes and databases are undone.

The path I recommend is that you run the following commands simply to determine the installation path of devise on the fly machines:

fly ssh console
cd /app
bin/bundle show devise

The second step would be to run bin/bundle open devise on your machine. Save the updated parameter_sanitizer.rb someplace within the source code directory of your application (perhaps within the config directory?)

The third step would be to modify your Dockerfile to copy the updated parameter_sanitizer.rb to the image that will be deployed every time your application starts. This is done by adding a COPY statement to your Dockerfile. The statement will look something like the following:

COPY config/parameter_sanitizer.rb /app/vendor/bundle/ruby/3.1.0/gems/devise-4.8.1/lib/devi/parameter_sanitizer.rb

This statement would go someplace shortly after the COPY statements in the # copy installed gems section of your Dockerfile.

The final step would be to run fly deploy.