I'm trying to use Ransack on RoR app.
https://github.com/activerecord-hackery/ransack
Unfortunately latest ransack only support ruby 2.6+. Mine is 2.5.8.
So what should I do? Any available version is there on Ransack?
You can use an older version, namely 2.4.1.
If you look on rubygems.org, you can quickly see the minimum required ruby version for each version of the gem:
2.4.2 requires ruby >= 2.6
2.4.1 requires ruby >= 2.3
However, you shouldn't even ordinarily need to check this manually!! If you run bundler update ransack on a project, it will automatically fetch the latest compatible version of the gem, given all your other dependencies.
Related
Ubuntu 22.04
I was able to install rails 1.9.2 rbenv but I can't match a rails version to it.
On the old server
rails -v returns:
The program 'rails' can be found in the following packages:
ruby-railties-3.2
ruby-railties-4.0
When I go to install Rails gem install rails
I get...
ERROR: Error installing rails:
concurrent-ruby requires Ruby version >= 2.2.
I do not know why you need to run such an old version of Ruby, but I guess there are reasons.
gem install rails will just try to install the latest version of Ruby on Rails that obviously is not compatible with such ancient version of Ruby as 1.9.2.
There are pages that list the compatibility between certain Ruby and Ruby on Rails versions, for example, this or this. When looking at those tables, I guess the best choice seems to be Ruby on Rails 3.2.x. To install the latest 3.2.x version of Rails use this command:
gem install rails -v 3.2.22.5
Running such ancient Ruby and Ruby on Rails will lead to endless problems. Foremost, there are likely unfixed security vulnerabilities in those old versions. But finding good documentation, compatible gems and support in general will be hard too.
I guess from your question that you inherited an old project without much documentation and – most importantly – without a Gemfile. Therefore, I suggest adding bundler and a proper Gemfile. You will need to figure out all your app's dependencies to install the application anyway, better document those dependencies with bundler right from the start. This examples might help.
I have installed Ruby On Rails version 6.0.3.2 but now I want to change it to Version 5. How can I do it?
Do I uninstall version 6 and install 5? What command should I use please?
You can have multiple versions of a gem installed:
gem install rails -v 5.2.4.4
And all modern rails versions have a way to select which specific one to use when creating a new app:
rails _5.2.4.4_ new application_name
If you want to downgrade an existing app - first search for a commit that upgraded it, if you're very lucky - a simple revert can do the job. But in more general case - you have to make your code compatible with older version (remove new feature usage etc), and fiddle with gem versions inside the Gemfile. Do a bundle update after edit - when a lower version is specified in requirements it will downgrade. Note that rails may be not the only gem requiring downgrade
I'm trying to install capybara on a setup with Ruby 1.8.7 and Rails 2.3, but I received this message:
capybara requires Ruby version >= 1.9.3.
I have two questions.
The more relevant question:
What is the latest capybara version compatible with that setup?
The more important question:
How I can check that on my own?
Regarding Capybara's Ruby version dependency, I went to the capybara source code and read its History. Searching for "Ruby" quickly got me to the statement that Capybara dropped support for Ruby 1.8 in version 2.0.0. So the previous version, 1.1.4, is the most recent version compatible with Ruby 1.8.
Unfortunately that file says nothing about Rails versions. My Rails 2 projects used webrat, so I don't have any personal data points. However, Googling '"rails 2" capybara version' turns up examples of using Capybara 1.1 with Rails 2 (for example in the Cucumber documentation), so the most recent Capybara version that is compatible with your Ruby is also compatible with your Rails.
In your gemfile, specify a version so you can install it. Looking at an REE app i have at work, we're using 1.1.4:
gem 'capybara', '~> 1.1.4'
The ~> with 1.1.x will ensure it always stays at a 1.1.x patch level. Similarly if you use ~> 1.2 it will always stay at a 1.x patch level.
I'm trying to specify factory_girl_rails version less than 3.0 as I don't have ruby 1.9 installed and 3.0 isn't compatible with 1.8.x. I've tried a few ways round but it always tries to install 3.0.0 and fails on the ruby dependency.
According to this, Rails 3.0 should still be compatible with Ruby 1.8.7 (they aren't dropping Ruby 1.8 support until 4.0).
But, if you put this in your Gemfile, bundler should use the latest 2.3 version (the last minor version before 3.0) of Rails:
gem 'rails', '~>2.3'
I'm installing ruby on rails on my OS X 10.7 machine and trying to follow along with this book: Agile Web Development with Rails.
Anyway I have installed Ruby 1.9.3 and then ran gem install rails and it pulled down rails 3.1.3, now the book says when I run 'rails -v' I should get 3.2.0 or NEWER.
I checked out http://rubygems.org/gems/rails and it says the latest version is rails 3.2.0 RC2, how is it that the book specifies (in multiple places to it's not a typo) that it should be 3.2.0 or NEWER when 3.2.0 isn't even released?
Actually, if you want the latest unstable version, run this:
gem install rails --pre
It'll install the latest RC.
EDIT: as to why the included 3.2.0 when it is not out yet, I can't answer for them! Maybe you have a "beta" version of the book?
Looks like you're specifying an explicit dependency on a future version of Rails, probably something like gem 'rails', '3.2.0'. If you indeed want to use this version, you'll have to settle for one of the release candidates for now:
gem 'rails', '3.2.0.rc2'
Or borrow a time machine.