Search code examples
ruby-on-railsrubyrubygemsrvmasdf-vm

How to use two versions of the same gem on the same ruby version in asdf?


I have switched from rvm to asdf and need a behaviour similar to gemsets in rvm. I have two folders with the same project - one with the old version of it and one with the latest one. They have the same ruby version, but different versions of some of the gems. Is it possible in asdf to be on e.g. ruby 2.6 and run bundle on both projects without worrying about the conflicts?


Solution

  • Remember that Gemfile and Gemfile.lock should make it possible to have multiple versions of the same gem installed and the correct one will be selected based on whatever constraints are described.

    The only time you'll need to force a single version is when dealing with command-line tools (e.g. rails or rake) where only one can be active at any given time.

    Gemsets are a byproduct of a time before Bundler and Gemfile.