After update to rails 5.1 gives error on gem "activemodel" - ruby-on-rails

After updating to rails 5.1 from 4.2.8 It gives error on running 'bundle update'.
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
protected_attributes (~> 1.1.4) was resolved to 1.1.4, which depends on
activemodel (< 5.0, >= 4.0.1)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activemodel (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activemodel (= 5.1.0)
It seems that protected_attributes gem doesn't compatible with rails version 5.1. Is there any way to tackle this issue without removing protected_attributes gem?

As the project's README states:
This plugin will be officially supported until the release of Rails 5.0
So either maintain your own fork that keeps compatibility with Rails 5.0 and upwards or bite the bullet and embrace strong parameters.

Related

Having issue while upgrading rails from 4.x to 5.x

I am having issues while upgrading rails versions. My ruby version is 2.6.3 and my current rail version is 4.2.1.
I tried with rake rails:update and rails app:update, but both of them gave me this error.
You have requested:
rails = 5.0.7.2
The bundle currently has rails locked at 4.2.11.2.
Try running `bundle update rails`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
Trying what was suggested in the error gave me this error.
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
ancestry was resolved to 3.2.1, which depends on
activerecord (>= 4.2.0)
annotate (~> 2.6.5) was resolved to 2.6.10, which depends on
activerecord (>= 3.2, <= 4.3)
globalize was resolved to 5.3.1, which depends on
activerecord (>= 4.2, < 6.1)
activeadmin was resolved to 1.0.0, which depends on
kaminari (>= 0.15, < 2.0) was resolved to 1.2.1, which depends on
kaminari-activerecord (= 1.2.1) was resolved to 1.2.1, which depends
on
activerecord
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0)
activeadmin was resolved to 1.0.0, which depends on
ransack (~> 1.3) was resolved to 1.8.4, which depends on
activerecord (>= 3.0)
seed_dump was resolved to 3.3.1, which depends on
activerecord (>= 4)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 5.0.0)
active_admin-sortable_tree was resolved to 1.0.0, which depends on
rails (>= 3.2)
My end goal is to upgrade rails 4.x to 6.x. I am going step by step by upgrading rails 4.x to 5.x and then 5.x to 6.x. I am not able to achieve the first phase i.e upgrading 4.x to 5.x.
Any help regarding how can I solve this issue would be much appreciated. Thanks.

Use Paper Trail in Rails 6.0.0.beta1

I am trying to upgrade my rails application from 5.2.2 to version 6.0.0.beta1. Ruby version currently using is ruby-2.5.3. But it gives me dependencies issues related to already added gems. Likewise in case of paper_trail. I have tried by forking paper_trail gem, comment out the dependencies inside gemspec files and provide a reference to that forked application to application. It removes dependencies but still doesn't work for me. Any idea on how to use this gem in rails 6.0.0beta1 version?
Steps to upgrade rails version in my application:
Changed gem 'rails', '~>5.2.2' to gem 'rails', '6.0.0.beta1', github: 'rails/rails', ref: '5a0230c67f852fb21173f99647e76336897446c1'
Run 'bundle update rails'
And it produced issues as below.
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
annotate was resolved to 2.7.4, which depends on
activerecord (< 6.0, >= 3.2)
delayed_job_active_record was resolved to 4.1.3, which depends on
activerecord (< 5.3, >= 3.0)
kaminari was resolved to 1.1.1, which depends on
kaminari-activerecord (= 1.1.1) was resolved to 1.1.1, which depends on
activerecord
paper_trail was resolved to 10.2.0, which depends on
activerecord (< 6.1, >= 4.2)
rails (= 6.0.0.beta1) was resolved to 6.0.0.beta1, which depends on
activerecord (= 6.0.0.beta1)
rails-erd was resolved to 1.5.2, which depends on
activerecord (>= 3.2)
activeadmin-select2 was resolved to 0.1.8, which depends on
activeadmin was resolved to 1.4.3, which depends on
ransack (>= 1.8.7) was resolved to 2.1.1, which depends on
activerecord (>= 5.0)
seed_dump was resolved to 3.3.1, which depends on
activerecord (>= 4)
state_machines-activerecord was resolved to 0.5.2, which depends on
activerecord (< 6.0, >= 4.1)
textacular was resolved to 5.1.0, which depends on
activerecord (< 6.0, >= 5.0)

updating rails 4.2.5 to rails 5, keep having ActiveModel dependencies issues

when updating a rails 4.2.5 app (thats in production on heroku) to rails 5, i keep running into the below incompatible version for the gem, i've tried the bundle update, bundle install, done everything asked by the upgrade docs on rails site and stackoverflow.
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (= 5.0.0)
In Gemfile:
active_model-errors_details was resolved to 1.3.0, which depends
on
activemodel (< 5.0.0.beta1, >= 3.2.13)
carrierwave was resolved to 1.2.2, which depends on
activemodel (>= 4.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
web-console (~> 2.0) was resolved to 2.3.0, which depends on
activemodel (>= 4.0)
Running `bundle update` will rebuild your snapshot from scratch,
using only
the gems in your Gemfile, which may resolve the conflict.
There is no version of the active_model-errors_details that supports Ruby on Rails 5.x (see its Rubygems page).
But the documentation of the active_model-errors_details says that it is a feature backported from Rails 5.0 to use with Rails 3.2.x and 4.x apps.
Therefore I think there is no need to keep that gem in your application once you update to Ruby 5.0. Just remove the gem 'active_model-errors_details' line from your Gemfile and run bundle install again.

Ruby on Rails: Gem Dependency Issues

I am trying to install the most recent version of haml, simple_form, and devise to my Ruby on Rails application, but I cannot seem to get them working with the Bundler tool. How should I proceed in order to get past the dependency issues?
This is the error raised by the Bundler tool:
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (= 5.1.1)
In Gemfile:
rails (~> 5.1.1) was resolved to 5.1.1, which depends on
activemodel (= 5.1.1)
rails (~> 5.1.1) was resolved to 5.1.1, which depends on
activemodel (= 5.1.1)
simple_form (~> 3.4) was resolved to 3.4.0, which depends on
activemodel (< 5.1, > 4)
web-console (>= 3.3.0) was resolved to 3.5.1, which depends on
activemodel (>= 5.0)
Unfortunately, simple_form is not compatible yet with Rails 5.1 as you can see from this commit https://github.com/plataformatec/simple_form/commit/8d15b7ebc8096348b611e9f2905a2576a5bce508
You'll either have to wait for a new version of simple_form or use an earlier version.
Run bundle update with --conservative key, it does not try to update rails dependencies, these gems have.
bundle update haml simple_form devise --conservative
If you may, try using rails version 4.2.4
This will allow you to use 'simple_form' and 'nested_form' if needed.

Bundler could not find compatible versions for gem "rails": In snapshot (Gemfile.lock): rails (= 4.2.7.1)

I am upgrading to openproject lastest version 6, however while running bundle install, I am getting the following error:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 4.2.7.1)
In Gemfile:
rails (>= 4.2.7.1, ~> 4.2.7)
health_check was resolved to 1.5.1, which depends on
rails (>= 2.3.0)
openproject-translations was resolved to 6.0.5, which depends on
rails (~> 4.2.3)
prototype-rails was resolved to 4.0.0, which depends on
rails (~> 4.0)
rails-angular-xss was resolved to 0.2.0.pre.pre, which depends on
rails (< 5.1, >= 5.0.0)
rails_autolink (~> 1.1.6) was resolved to 1.1.6, which depends on
rails (> 3.1)
Any help would be appreciated.
Thanks,
Rahul
1- Make sure you specify the correct rails version in Gemfile
2- Remove Gemfile.lock rm Gemfile.lock
3- bundle install
You have dependencies which are incompatible.
openproject-translations was resolved to 6.0.5, which depends on
rails (~> 4.2.3)
This requires rails 4.2.x (where x >= 3)
rails-angular-xss was resolved to 0.2.0.pre.pre, which depends on
rails (< 5.1, >= 5.0.0)
This requires rails 5.0.x (< 5.1, >= 5.0.0 could be simplified to ~> 5.0.0)
Since openproject-translations requires Rails 4 and rails-angular-xss requires Rails 5 there is no way that bundle can resolve them.
You could try a different version (e.g. rolling back a recent change) of one or both of those gems.
Instead of the 0.2.0.pre.pre version of rails-angular-xss, try the latest release 0.1.0 which will work for your current version of Rails.

Resources