Awesome_nested_set for ruby 1.8 - ruby-on-rails

Trying to install the awesome_nested_set gem for ruby 1.8.7 rails 2.3.8 environment
ERROR: Error installing awesome_nested_set:
activesupport requires Ruby version >= 1.9.3.
How do i check what version is compatible with 1.8.7 ?
Are there any other options for nested set structure ?

If you really need a historical version you can always install it with:
gem install awesome_nested_set -v x.x.x
Where x.x.x is an older version number. You can lock this down in your Gemfile as well.

Related

Mismatched ruby version after downgrade from 2.4.1 to 2.3.3 while running bundle install

While attempting to solve another issue identified in this thread:
Error while trying to load the gem 'devise. ActiveSupport: Duration can't be coerced into Integer, I followed the suggested solution and changed my ruby version from 2.4.1 to 2.3.3 using rbenv. I also made similar changes in my Gemfile to reflect the new ruby version. However, when I tried to bundle install again, it throws an error saying that my ruby version is 2.4.1, when my Gem specified 2.3.3. However, running ruby -v shows my ruby version is on 2.3.3.
$ bundle install
Your Ruby version is 2.4.1, but your Gemfile specified 2.3.3
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
Any help here would be appreciated. Thank you!
Gem installation is specific to ruby version, so the bundler you're using is likely installed to your old ruby. Try installing bundler again:
gem install bundler
That should fix your problem.

Bundle install doesn't work - Rubymine - (Gem::InstallError: activesupport requires Ruby version >= 2.2.2.)

I am doing a project in Rubymine and I get a notice that I need to install some gems. When I do the bundle install I get the following error:
Gem::InstallError: activesupport requires Ruby version >= 2.2.2. An
error occurred while installing activesupport (5.1.0), and Bundler
cannot continue.
Make sure that gem install activesupport -v '5.1.0'
succeeds before bundling.
Process finished with exit code 5
I am using version 2.4.0 of Ruby, so I do not understand why I get this error.
Thanks for the help!
First check your ruby version.
$ which ruby
/Users/.rvm/rubies/ruby-2.1.2/bin/ruby
$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
Use the Ruby 2.4 version instead...
rvm install 2.4
rvm use 2.4
Rubymine has nothing to do with this.
As #Sunny commented out you need to make sure the ruby version you are using. I recommend you to create a new file on the app root directory, name it .ruby-version and inside add the ruby version you want ruby-2.4.0 (you can always modify it later and set a different versions).
Also you might want to use a ruby version manager like rvm or rbenv both are good, on my personal preference I use rbenv for development and rvm for production environments. You can follow this guide, feel free to change the OS and the ruby manager as you prefer.

Trouble installing gems with bundler

I'm new to Rails, following Michael Hartl's textbook. When I run $ bundle install I get the following error:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.7.6)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
I then try $ gem install bundler which works fine:
Successfully installed bundler-1.7.6
Parsing documentation for bundler-1.7.6
1 gem installed
However, this doesn't solve the problem. I'm sensing this has something to do with version problems, but I'm not sure where to go with it...
The following :
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
means the version of bundler required is greater than or equal to 1.0.0 but strictly less than 1.1.0. Rails 3 is depending on an old version of bundler. At this point of time, you should try out Rails 4 instead :)
You may read up more about the "version syntax" in http://guides.rubygems.org/patterns/#pessimistic_version_constraint
As #user3927334 has already stated the error you got is due to a version conflict between bundler and rails.
Most likely you have run rails new my_app with an outdated version of the rails gem.
gem install rails -v 4.2.0.beta4
Can be used to install a particular version of Rails. see Installing Rails.
You should then remove your old app and rerun the app generator:
rails _4.2.0.beta4_ new hello_app
If you indent to develop on your local machine I would recommend installing RVM (Ruby Version Manager) (as did previous versions of MH's Ruby on Rails Tutorial.)
It allows you to effortlessly switch between different versions of ruby and different sets of gems.

How to switch rails 4 to rails 3?

This is what I have done:
gem uninstall rails
gem uninstall railties
gem install rails 3.2
And terminal shows this code:
Done installing documentation for rails, railties after 1189 seconds
ERROR: Could not find a valid gem '3.2' (>= 0) in any repository
2 gems installed
weare138#mycomp:~$ rails -v
Rails 4.1.5
How to fix it?
You are missing the -v flag so rubygems is thinking that 3.2 is the name of a different gem and you are installing the current version (4.1.5). Instead try:
gem install rails -v 3.2.19
You should not need to remove up-to-date versions as you can specify the older rails version when starting a project with:
rails _3.2.19_ new myapp
If you are using RVM, create a new gemset
rvm gemset create <name>
Then you can switch to that gemset using
rvm use 1.9.3#<name> #assuming your ruby version is 1.9.3
That gives a clean gemset you can install Rails 3.2 to. Maintain multiple gemsets and switch between them

Unable to activate rails 3.0.1 because of bundler version conflict

so I run:
$ gem install rails --version 3.0.1
Successfully installed rails-3.0.1
1 gem installed
Installing ri documentation for rails-3.0.1...
Installing RDoc documentation for rails-3.0.1...
then I get the error:
$ rails -v
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate rails-3.0.1, because bundler-1.1.4 conflicts with bundler (~> 1.0.0) (Gem::LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1232:in `gem'
from /usr/local/rvm/gems/ruby-1.9.3-p125#rails3tutorial/bin/rails:18:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p125#rails3tutorial/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p125#rails3tutorial/bin/ruby_noexec_wrapper:14:in `<main>'
So Rails 3.0.1 requires Bundler v1.0.0 - v1.0.22 (actually any 1.0.x version up to, but not including, 1.1.0), but you have a newer version of Bundler that's being loaded when Rails is started. You could uninstall the newer version(s) of Bundler (though this is a crappy way to deal with the issue) or since you're using RVM, just create a gemset for Rails 3.0.1.
$ rvm gemset create rails_3.0.1
$ rvm gemset use rails_3.0.1
$ gem install rails -v 3.0.1
$ rails -v
3.0.1
Note: this requires that Bundler not be in your global gemset for the Ruby version you're trying to use. If the global gemset contains a Bundler version equal to or higher than 1.1.0 then you'll get the same error as before.
Update: A little explanation about ~> and RubyGems versioning might be handy. The section on pessimistic version constraint in the RubyGems docs does a fantastic job of covering everything.
You may need to update to bundler 1.1.4.
gem update bundler
should do the trick.
This is possibly due to Ruby v1.9.2/3 uses bundler v1.1.4 while Rails v3.0.1 requires bundler v~1.0.0. Hence, by simply updating the Rails version to v3.2.6, the conflict is solved. This conflict can be easily solved by matching the Ruby and Rails version.
I had same problem with mysql. I uninstalled mysql gem and I installed the newest version of mysql gem. Is RVM ok?

Resources