How to change ruby current version by using Capistrano? - ruby-on-rails

We are using ruby version 1.8.7 in our staging server but we need to have ruby 2.4.0 to install rails 5.0. We have installed both versions of ruby, i.e., ruby 1.8.7 and 2.4.0 by RVM through Capistrano.
We have tried to change the ruby version from 1.8.7 to 2.4.0 to install rails 5.0.
But the problem is the ruby version does not change to 2.4.0.
Capistrano version: 2.15.4.
What do we need to do to change the ruby version to 2.4.0 and install Rails 5.0 in staging by Capistrano?

Related

Just installed Rails 6 and am getting an odd error

installed ruby 2.6.4 and rails 6.0.0 using rbenv on a mac running Mojave 10.14.6 to evaluate upgrading a legacy app. rails -v returns `
Rails 6 requires Ruby 2.5.0 or newer.
You're running
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Please upgrade to Ruby 2.5.0 or newer to continue.`
however ruby -v returns ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
I currently have the following versions of ruby installed
ruby-2.2.6
ruby-2.3.8
* ruby-2.6.4
which ruby returns
/Users/jerryzornes/.rubies/ruby-2.6.4/bin/ruby
and my bundler version is 2.0.2
So I have no idea as to what's going on.
In the root folder of your Rails app make sure you have a file named .ruby-version that contains the text ruby-2.6.4. This is used by rbenv to make sure the right version of ruby is used.
You can also run which ruby to see where it is loading ruby from. If this isn't running from /Users/jerryzornes/.rubies/..., then the issue is with your rbenv install. I would check you path variable to make sure it has the rbenv shims in place, ie looks like ~/.rbenv/shims:/usr/local/bin:/usr/bin:/bin

Upgrade Ruby version while deploying to EB

I have a production rails application on Ruby 2.2.5 but I updated my app to ruby 2.5.3 and rails from 4.2 to 5.2. When I try to deploy this to ElasticBeanstalk I get the following errors everytime:
Warning: the running version of Bundler is older than the version that created the lockfile.
We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Your Ruby version is 2.2.5, but your Gemfile specified 2.5.3.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
To fix this I ssh'd into the instance and installed rvm before updating the ruby version using
rvm --default use 2.5.3
After this I updated my bundler as suggested in the error message but it seems like the ruby version gets reset to 2.2.5 everytime I close my connection and ssh in again because doing
ruby -v gives 2.2.5
How can I update the ruby version on my instance?
Elastic Beanstalk sets the Ruby version in the Platform (you can think of this as the base AMI). To upgrade this you'll need to update your platform version.
Depending on the web server you use, it sounds like you'll need one of:
64bit Amazon Linux 2018.03 v2.8.7 running Ruby 2.5 (Puma)
64bit Amazon Linux 2018.03 v2.8.7 running Ruby 2.5 (Passenger Standalone)

Capistrano 3: incompatible ruby version

I am deploying a rails app to Ubuntu 14.04 using Capistrano.
In remote Ubuntu server it shows I am using Ruby 2.3.0
I tried these commands to install Ruby
rbenv install 2.3.0
rbenv global 2.3.0
rbenv rehash
deploy#ubuntu:~$ rbenv versions
system
* 2.3.0 (set by /home/deploy/.rbenv/version)
deploy#ubuntu:~$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
But when I try cap production deploy, error happens and shows a different Ruby is working, instead of 2.3.0
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is
incompatible with
the current version, ruby 1.9.3p484
How can I fix this?

Railsinstaller 3.2.0 with ruby 2.2.3 on windows

I am installing rails through railsinstaller 3.2.0.exe file on my window but with this file I got ruby version 2.2.4 and i need ruby version 2.2.3.
Is it possible to change the ruby or rails version with railsinstaller package?

How can I switch between rails 3.2.13 and rails 4.0.0?

I am using ubuntu 12.04. I have installed ruby 1.9.3 and rails 3.2.13. When I check my version of rails using command rails -v, it shows Rails 4.0. How can I switch to Rails 3.2.13?
As you have already installed rails and its current version is 4.0, so please do this
gem install rails -v 3.2.13 and if you want to remove 4.0 version please do gem uninstall rails, you will get the list of rails and then choose 4.0.0 version.
Simple If you want to switch rails then you can install multiple rails version by using
sudo gem install rails -v 3.2.x or gem install rails or any version you want
If you want to switch ruby version use rvm and choose rvm use 1.9.3 or rvm use 2.0.0
Thanks
rails new appname will use the latest version of rails. To use an earlier installed version, call:
rails _3.2.13_ new appname
You can then have both versions of rails installed and not have to deal with uninstalling rails which can be problematic.

Resources