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
bundle exec foo.rb
Pass the script name to the ruby command:
ruby
bundle exec ruby script_name
If you also want the Rails environment:
bundle exec rails runner script_name