I am working on a project that requires Rails 2.3.3. I have Rails 5.2.2 already installed in my system.
I am asking how to install Rails 2.3.3 and work on that project. Any links would be much appreciated.
You can use rvm for different rails applications.
Try this link https://rvm.io/rvm/install.
After installing rvm. in your gem file you can mention your rails version. it will install automatically.
gem 'rails', '~> 2.3.3'
Related
I know the question to this is probably very straight forward, but Im a bit new to rails, so please bear with me. I have had rails version 5.1.5 on my Mac and I need to update rails to version 5.1.6 and I'm not able for the life of me to do that.
I tried
`sudo gem install rails -v 5.1.6`
but this gives the error
ERROR: Failed to build gem native extension.
Using gem list gives that I have
rails (5.1.5, 5.1.4)
I also tried bundle update rails
I keep getting Could not locate Gemfile
What am I doing wrong??
gem is the native package manager for Ruby.
Bundler (bundle) is a gem to manage bundles of gems via a Gemfile.
I recommend you use a version manager for Ruby like rvm, rbenv or chruby and also install xcode and the commandline-tools package of xcode. Some gems have dependencies written in C that need to be configured and compiled, all of that and some more comes with xcode.
I am using rails version 4.2.0. How can I downgrade to version 3.2.19?
I tried the following:
I opened command prompt.
I typed gem uninstall rails
Some options came for rails version then I selected my current version and pressed entered.
Then typed gem install rails -v 3.2.19 for installing this version.
I went to my Site directory and typed rails new blog
When I opened the Gemfile of blog application I found again Rails version 4.2.0 is present there.
Do:
gem uninstall rails
gem uninstall railties
Followed by:
gem install rails -v 3.2.19
To check a rails version, directly do:
rails -v
Another workaround:
add following to your Gemfile:
gem 'rails', '3.2.19'
and then run:
bundle install
Or you dont have to downgrade. You can always create a new rails app with a specific version(if that version is already installed)
rails _3.2.19_ new myApp
That is not good approach to uninstall a global version of Rails. So just create a Rails app:
rails new app
then change Rails version in its Gemfile, and issue bundle install:
cd app
sed "s/'rails', '~> 4.2.0'/'rails', '~> 3.2.19'/" -i Gemfile
bundle install
Then, I believe, you should change all the dependent packages to older versions.
I am newbie to Rails development and working with Spree Commerce bitnami Stack VM instance. I am trying to install spree extension and the instructions says to make configuration changes to application Gem file which I cannot find in the webserver directory
Running Rails 2.3.5
Spree 0.9.4 version
The reason why you can't find it because Gemfile is a standard from Rails 3+ and you're using a Rails2 app. Rails3 uses Bundler which takes cares about all Gems for your app.
In Rails 2 gem dependency definition is different. It doesn't have Bundler so "bundle install" also won't work in your case.
Instead you need to add Gem dependency to config/environment.rb like this:
config.gem 'your_gem_name_here'
also you need to install the Gem manually, so not like in Rails3 where Bundler installs it. Use this in shell:
gem install your_gem_name
In general it's a good idea to update the app to Rails3, I'd recommend it because as I saw this Gem you wanna use doesn't have earlier release.
I have currently moved to a appplication on rails 2.3.4 and ruby 1.8.7 using rvm.
There are a no of gems installed in the app.When i do gem install gem_name ,it installs it but iam not sure whether the gem version is compatible with my app.The gem versions are not specified in case of many gems listed config/environment.rb.Iam unable to figure out ,how to install the correct version as unable to run the application till now. Any suggestions are welcome..
To provide true gem-consistency in your app, you should consider use Bundler to manage these dependencies. The Gembundler site has a good guide on setup for rails 2.x apps.
Once you have your dependencies in bundler, you can start to work out what is compatible and what isn't. In the case of third-party gems, you can search for them on the RubyGems site, and work out which version was the last to be released before Rails 3.x was released. Of course most gems will just work, but any breaking gems will possibly need to run an older version.
I would use Bundler, and add the gems to the Gemfile. Here is the syntax to use a specific version:
gem 'gem-name', '1.0.4'
I have a rails app with the config/environment.rb line
config.gem 'authlogic', :version => '2.1.2'
The system gem for authlogic is 2.1.4
The one in my GEM_PATH is 2.1.2
No matter what I try, Rails is only using the 2.1.4 version, which is a problem. How to force rails to use 2.1.2?
Thanks
I recommend using Bundler
i've made a test here, included the gem authlogic, choose to use the 2.1.3 version, and the application ran without problems.
then i've uninstalled the gem (gem uninstall authlogic -v=2.1.3), and my application didn't ran anymore, normal behavior (i'm using rails 2.3.8 for this test)
you could try uninstalling and then installing the gem again
To be safe, uninstall your 2.1.4 version, freeze 2.1.2, then uninstall 2.1.2 too.
Unpack the gems into your rails app. This'll also help in deployment.
rake gems:unpack
Sys admin re-installed some gems and all the problems went away.