Rails gem update not working (version 4.1.1 to 4.2.0) as a solution to "warning: circular argument reference" error
Asked Answered
H

3

3

I keep getting the following error when I run any sort of rake command, and in particular rake db:seed which will abort without completing:

$ rake db:seed
/Users/rachel/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now
rake aborted!
ActiveRecord::UnknownAttributeError: unknown attribute: description

I did some research and discovered this is an error (I think?) caused by an incompatible gem in Rails 4.1.9 so I was hoping to create a new rvm to update Rails to 4.2.0 so I can proceed with my projects. However, every time I try to update Rails it says 'installed' but fails to actually install into the ruby version I created. Here's the typical command line pattern when I try to update Rails:

$ rvm gemset create rails420
ruby-2.2.0 - #gemset created /Users/rachel/.rvm/gems/ruby-2.2.0@rails420
ruby-2.2.0 - #generating rails420 wrappers........
$ rvm 2.2.0@rails420
$ gem install rails -v 4.2.0
Fetching: rails-4.2.0.gem (100%)
Successfully installed rails-4.2.0
Parsing documentation for rails-4.2.0
Installing ri documentation for rails-4.2.0
Done installing documentation for rails after 339 seconds
1 gem installed
$ rvm 2.2.0@rails420
$ rails --version
Rails 4.1.1

Basically, it installs Rails 4.2.0 but then says it's not installed when I check the version immediately after installation. Any ideas for how I can either solve the error or get the Rails gem to update correctly in my rvm?

Hewlett answered 3/3, 2015 at 4:20 Comment(0)
R
0

Try the following :

rvm use [email protected] --create
gem install rails
rails -v

This should give you rails 4.2

Rend answered 3/3, 2015 at 4:29 Comment(8)
Thanks for responding but I get the same error when I follow that code: "$ rvm use [email protected] --create Using /Users/rachel/.rvm/gems/ruby-2.2.0 with gemset rails4.2 $ gem install rails Successfully installed rails-4.2.0 Parsing documentation for rails-4.2.0 Done installing documentation for rails after 1 seconds 1 gem installed $ rails -v Rails 4.1.1" I've tried creating separate rvms and also tried updating Rails in the global gemset, and every time I get the same error where the update doesn't take. Is there anything else I could try?Hewlett
Try to run gem update , then do the rails update againRend
I updated my Mac OS, updated Ruby to 2.2.0 and updated all my outdated gems but still got the same error: $ gem update Updating installed gems Updating jbuilder Gems updated: jbuilder $ rails -v Rails 4.1.1 $ gem install rails Successfully installed rails-4.2.0 Parsing documentation for rails-4.2.0 Done installing documentation for rails after 0 seconds 1 gem installed $ rails -v Rails 4.1.1 Could it be a problem with my system somehow? Or a problem with my version of Ruby? I've tried basically every update I could research but every single time the rails -v comes back with 4.1.1Hewlett
ok I suggest you remove rails 4.1.1first and install 4.2 again. gem uninstall rails -v 4.1.1Rend
But be careful with this as I am not sure if it's gonna effect you current app.Rend
Thanks - I did what you suggested anyway because without rake db:seed my current app isn't working anyway, but even after uninstalling 4.1.1 and reinstalling 4.2 it still says that the current Rails version is 4.1.1. Is there a chance this is a bug or is there anything left to do? All I can think of is uninstalling the entire Ruby setup from my computer but I don't think that would work, since I have uninstalled Rails several times and also created new rmvs that would only have Rails 4.2 -- except that they all end up with 4.1.1 no matter what.Hewlett
(Thanks for your help by the way, I can't upvote you because my reputation is still too low but I really appreciate it. I'm relatively new to this and this issue has ground my use of Ruby/Rails to a halt, since none of my rakes will work without solving the 'circular argument reference' error and I can't see to solve that without updating to Rails 4.2).Hewlett
That's very puzzling, go a head and open a ticket on Rails main GitHub repository. github.com/rails/rails/issuesRend
H
1

The issue causing the "warning: circular argument reference" was that the files in my project's Gemfile.lock didn't match the versions I was installing so it kept reverting to an out-of-date version and causing an error.

To fix, I updated all my gemsets and ran cleanup to make sure there were no out of date versions remaining, then ran the following commands:

rvm use --create 2.2.0@newtest
gem install rails
Fetching: rails-4.2.0.gem (100%)
Successfully installed rails-4.2.0
Parsing documentation for rails-4.2.0
Installing ri documentation for rails-4.2.0
Done installing documentation for rails after 326 seconds
1 gem installed
$ bundle install

I then checked the version to make sure that activerecord, activesupport, rails, and railties all had at least 4.2.0. Once I was sure those gems were working I created a new Rails project in the new updated rvm:

$ rvm use ruby-2.2.0@newtest
$rails new projectname

This created a new project with Rails 4.2.0 which is compatible with the right gems to avoid the "warning: circular argument reference" error, so I am no longer seeing it when I use rake or any other command. For a more detailed explanation see api.rubyonrails.org/classes/Rails/Railtie.html - Railtie is the gem that coordinates Rails actions like rake, so if it is out of date in your Gemfile.lock but not in your Ruby rvm it will create the error.

Hewlett answered 3/3, 2015 at 5:53 Comment(0)
R
0

Try the following :

rvm use [email protected] --create
gem install rails
rails -v

This should give you rails 4.2

Rend answered 3/3, 2015 at 4:29 Comment(8)
Thanks for responding but I get the same error when I follow that code: "$ rvm use [email protected] --create Using /Users/rachel/.rvm/gems/ruby-2.2.0 with gemset rails4.2 $ gem install rails Successfully installed rails-4.2.0 Parsing documentation for rails-4.2.0 Done installing documentation for rails after 1 seconds 1 gem installed $ rails -v Rails 4.1.1" I've tried creating separate rvms and also tried updating Rails in the global gemset, and every time I get the same error where the update doesn't take. Is there anything else I could try?Hewlett
Try to run gem update , then do the rails update againRend
I updated my Mac OS, updated Ruby to 2.2.0 and updated all my outdated gems but still got the same error: $ gem update Updating installed gems Updating jbuilder Gems updated: jbuilder $ rails -v Rails 4.1.1 $ gem install rails Successfully installed rails-4.2.0 Parsing documentation for rails-4.2.0 Done installing documentation for rails after 0 seconds 1 gem installed $ rails -v Rails 4.1.1 Could it be a problem with my system somehow? Or a problem with my version of Ruby? I've tried basically every update I could research but every single time the rails -v comes back with 4.1.1Hewlett
ok I suggest you remove rails 4.1.1first and install 4.2 again. gem uninstall rails -v 4.1.1Rend
But be careful with this as I am not sure if it's gonna effect you current app.Rend
Thanks - I did what you suggested anyway because without rake db:seed my current app isn't working anyway, but even after uninstalling 4.1.1 and reinstalling 4.2 it still says that the current Rails version is 4.1.1. Is there a chance this is a bug or is there anything left to do? All I can think of is uninstalling the entire Ruby setup from my computer but I don't think that would work, since I have uninstalled Rails several times and also created new rmvs that would only have Rails 4.2 -- except that they all end up with 4.1.1 no matter what.Hewlett
(Thanks for your help by the way, I can't upvote you because my reputation is still too low but I really appreciate it. I'm relatively new to this and this issue has ground my use of Ruby/Rails to a halt, since none of my rakes will work without solving the 'circular argument reference' error and I can't see to solve that without updating to Rails 4.2).Hewlett
That's very puzzling, go a head and open a ticket on Rails main GitHub repository. github.com/rails/rails/issuesRend
H
0

This has now been resolved.

http://weblog.rubyonrails.org/2015/6/16/Rails-3-2-22-4-1-11-and-4-2-2-have-been-released-and-more/

fix ruby 2.2 warning: circular argument reference https://github.com/rails/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7

use self.method syntax to resolve circular argument issues https://github.com/rails/rails/commit/3a30b12c774dfaa72acfe520e823374131631ea9

Hesitation answered 29/7, 2015 at 7:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.