After upgrading my Ruby version, I've (as expected) run in to some trouble getting my server up and running with older projects. I'm curious about how to switch Ruby versions locally for a specific project. Rbenv's github page uses $ rbenv local 1.9.3-p327
as an example command of how to do this. What I want to know is what the -p327
refers to, what it should be in my case, and if it's even necessary. Can I just run $ rbenv local 2.3.1
for example?
(In my case, I am currently using Ruby -v 2.4.0 want to go back to an earlier version to avoid a Devise Gem error that I can't seem to get past.)
$ rbenv local 2.3.1
will do exactly as you surmised. The project specific version of Ruby is set via a .ruby-version
file in the project directory. This setting takes precedence over any use of rbenv global
that would set the Ruby version where otherwise unspecified.
Rbenv uses a file .ruby-version to detect the ruby version project is using . So are you having that file?
Based on the version of the ruby your project uses, just write a number in your file.
example: 2.3.0
To answer your other question,
Rbenv's github page uses
$ rbenv local 1.9.3-p327
as an example command of how to do this. What I want to know is what the-p327
refers to...
The old versioning policy for Ruby was MAJOR
. MINOR
. TEENY
- PATCH
p327
simply refers to patchlevel, which is basically a number that gets incremented for each accepted patch after the increment of a MINOR
number. Prior to Ruby 2.1 , security fixes did not increment the TEENY
version, so some releases specify the patchlevel.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.