Home > Net >  How to use two ruby,rails version on same machine but different project?
How to use two ruby,rails version on same machine but different project?

Time:05-06

Right now I have a project demo on my Desktop with versions

Ruby-2.6.3p62
Rails-4.2.11.3
Gem-3.0.3

and I want to create an another project new on my Desktop with versions

ruby-3.1.1p18
Rails-7.0.2.3
Gem-3.3.13

and currently, I have this rbenv version

rbenv version
2.6.3 (set by /home/akshit/.rbenv/version)

Can you share the commands on how to create project new without affecting my project demo?

CodePudding user response:

Using rbenv do this:

  • create project new
  • open a terminal inside root folder
  • write rbenv install 3.1.1 and then rbenv local 3.1.1 so for this project it will use the specified version

I suggest you to create a .ruby-version file where you set the project's ruby version, in this case 3.1.1

CodePudding user response:

You RBENV or RVM to achive this.

https://github.com/rbenv/rbenv

https://rvm.io/

  • Related