Rails `require': cannot load such file -- matrix - matrix

after updating to ruby 3.1.2 and Rails 7.0.2.3
getting following error while starting rails application:
`require': cannot load such file -- matrix (LoadError)
what could be the possible solution, thanks in advance.

Matrix was removed from Ruby's standard library in version 3.1. More info: https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released/
With Ruby 3.1, matrix needs to be explicitly added to the Gemfile. You can add it manually or run something like:
$ bundle add matrix
After it's added to the Gemfile, bundle your application:
$ bundle install
Then your application should continue to behave like it did in previous Ruby versions.

I came onto this issue as well when upgrading Rails 6->7 and Ruby 3.0.0->3.1.2.
For my case the issue was related to Capybara gem. Version 3.35.3 assumed it is installed by default with Ruby.
When I upgraded the Capybara to version 3.37.1 then matrix gem was automatically installed as well and the issue was resolved.

same here, ruby 3.1.2, rails 7.0.4 after adding prawn to gemfile. I had to add gem 'matrix' to gemfile and it works.

Just ran into the same issue after adding rubystats gem for some seed data, also using ruby 3.1.2 and rails 7.0.4.
#siasmj 's fix worked for me.

Related

Ruby 2.2.2 - Time zone reference

I just upgraded to Ruby v 2.2.2.
Now, when I start my console, I get this error:
.rvm/gems/ruby-2.2.2/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
Loading development environment (Rails 4.0.2)
I don't know what it means or how to fix it. I don't have a file called time_zone.rb in my application, so I assume its something that is incorporated by reference.
Does anyone know what to do to resolve this?
I see that you are using Rails in your project. You just need to upgrade your Rails version to 4.1.9.
This issue was fixed in these commits:
fix ruby 2.2 warning: circular argument reference
use self.method syntax to resolve circular argument issues
You can upgrade the Rails version in your Gemfile or Gemfile.lock files.
Gemfile
gem "rails", "4.1.9"
Gemfile.lock
rails (4.1.9)
Be sure to run bundle after you make these changes!

Issues using the latest Psych with Rails 3.2.8 & ruby 1.9.3

I recently hit some JSON parse issues and discovered we are using a pretty old version of Psych and libyaml: Psych version: 1.2.2; Psych libyaml version: 0.1.4
The latest Psych has much better JSON parsing support (subset of YAML) and I verified this fixes my issues, however I'm having issues configuring our Rails app to use the latest Psych gem versus the Psych version bundled with ruby.
I simply add gem 'psych' in the gemfile and run bundle install according to the online docs.
Now when I try to run anything I hit errors:
uninitialized constant Psych::Streaming::ClassMethods (NameError)
While it makes no sense, I know whats going on here, internally Rails is using the OLD version of Psych::Streaming which doesn't have these new methods. When I debug I see it using the old dir (e.g. ~Ruby1.9.3\lib\ruby\1.9.1\psych\streaming.rb) versus the NEW lib it should be using (e.g. ~Ruby1.9.3\lib\ruby\gems\1.9.1\gems\psych-2.0.8\lib\psych\streaming.rb)
So this seems like general confusion where code in the new Psych gem is calling code from the old bundled Psych version. How do I get Rails to not use the old bundled version and use the latest Psych??
We're using an older version of Rails (3.2.8) and ruby (1.9.3-p125) and unfortunately upgrading is not an option for the project right now...
** UPDATE **
It seems like root causing this problem will be a nightmare so maybe I need a new approach. Is there a way to ONLY use the latest Psych gem in my new code, but let everything else (like the external ruby libs) continue using the old bundled version? We had no issues with the old Psych version until I started passing around & parsing more complex JSON in my new code...

Can I control the version of rubygems that IntelliJ uses?

I'm trying to start a rails application in IntelliJ with the Ruby plugin.
I've imported the application and set up the run configuration as best I can. When I try to run it I get the error:
NoMethodError: undefined method `version_requirements' for #<Gem::Dependency:0x7de21f45>
When looking for an answer I found this page saying that I should do this:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Since it's IntelliJ's ruby plugin that is managing the gems, I assume that I have to change the version of rubygems-update that the plugin is using.
Is this the right approach to take? And if so, can anyone tell me how to go about it?
I tried listing the gems but that gem is not shows so I must not be listing the gems in the right place, but I don't know where to look.
Many thanks :)
IntelliJ IDEA cannot handle it, you will need to install the appropriate rubygems version from the command line.
Note that your current rubygems-update version may be different, verify it with gem list and use the reported version when uninstalling.

Rails server command generates error report

When I used rails server command, found following errors in terminal. It shows that "could not find a JavaScript runtime". I am newbie in ROR and don't know to configure different files. I Google and found solutions of this problem 1 2 3. Still I am not getting the things. Please suggest some solutions.
Ruby and Rail versions on my system
Ruby version:- ruby 1.8.7 , Rails version:- Rails 3.2.6
I suppose you lack executable on your system/
Haven't you try to run gem install execjs or bundle install(from your project directory) in console?
UPDATE
Also visit execjs homepage and try instaling any of JS runtimes supported.
UPDATE 2
I was able to reproduce your error (with ruby 1.9.2). Just add gem 'therubyracer' to your Gemfile and run bundle install. For some weird reason ROR is not working out of the box on Ubuntu. See this and search for runtime word for more info.
PS
Please put your Gemfile here. This might help.
The error message also tells your to
See https://github.com/sstephenson/execjs for a list of available runtimes.
You have to install one of the JavaScript runtimes listed there:
therubyracer
therubyrhino
Node.js
Microsoft Windows Script Host
For Rails 3.2.6 I suggest to use Ruby 1.9.3. for better performance.

Could not find rack-cache-1.0.3 in any of the sources

I have created a very basic Rails 3.1 app, deployed to a box that runs Ruby 1.8.7 (P334) (I can't easily go to 1.9.2. there unfortunately).
After deploying and running 'bundle install' I tried to run a console:
bundle exec rails console
And I get:
Could not find rack-cache-1.0.3 in any of the sources
and the console does not come up.
It seems that this particular version of rack-cache is listed as a dependency by ActionPack 3.1.0.
Can someone explain to me what I need to do to resolve this, i.e. get bundler to attach this version of rack-cache to the project?
Also I read that bundler stores the project-specific GEMs 'somewhere else', i.e. no longer in the global Ruby GEM path. Is there a default location for this project specific place ?
Oh and I also keep getting heaps of 'invalid gemspec' warnings with Rails 3.1, i.e.:
Invalid gemspec in [/usr/local/lib/ruby/gems/1.8/specifications/rack-cache-1.0.3.gemspec]: invalid date format in specification: "2011-08-27 00:00:00.000000000Z"
Ran into this issue when upgrading my Rails 3.0 app to 3.1.
Edit the /usr/local/lib/ruby/gems/1.8/specifications/rack-cache-1.0.3.gemspec file and set s.date = %q{2011-08-27}. This will fix your problem.

Resources