I have a Ruby script called foo.rb, and I want to run it within the context of the bundler environment. How?
bundle exec foo.rb
doesn't work, because exec expects a shell script.
Pass the script name to the ruby
command:
bundle exec ruby script_name
If you also want the Rails environment:
bundle exec rails runner script_name