Questions tagged [ruby-3.1]

For issues relating to development in Ruby, version 3.1. If your question applies to Ruby in general, use the tag [ruby].

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Ruby 3.1 was released Dec 25, 2021.

For information on Ruby in general, visit . And API documentation for Ruby 3.1.0.

The official release 3.1 announcement summarizes the changes as:

  • YJIT: New experimental in-process JIT compiler
  • debug gem: A new debugger
  • error_highlight: Fine-grained error location in backtrace
  • IRB Autocomplete and Document Display
  • and many more
24 questions
78
votes
2 answers

Rails 7 Ruby 3.1 LoadError: cannot load such file -- net/smtp

I upgraded to Rails 7 and Ruby 3.1. While trying to run tests with rspec I got the error below. How can I fix it? An error occurred while loading rails_helper. Failure/Error: require File.expand_path('../config/environment', __dir__) LoadError: …
Sergey Alekseev
  • 11,910
  • 11
  • 38
  • 53
7
votes
2 answers

What's the right string to use when installing Ruby 3.1 through RVM on Mac OS Big Sur?

I’m using Mac OS Big Sur and rvm $ rvm -v rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] I have version 2.7.5 of Ruby installed and would like to install version 3.1. I tried $ rvm install 3.1 Unknown…
Dave
  • 15,639
  • 133
  • 442
  • 830
6
votes
6 answers

LoadError: cannot load such file -- sassc

running rake assets:precompile ends with the error. Can't find why it still requires sassc, sassc only was in project when migrated to sprockets 4 using Guide to upgrading from Sprockets 3.x to 4.x: gem 'sass-rails', '>= 5' bundle update sass-rails…
Goaul
  • 943
  • 11
  • 13
4
votes
1 answer

heroku[router]: at=error code=H10 desc="App crashed" method

on Ruby on Rails - Heroku deployment, I got a error of heroku[route]: at=error code=H10 desc="App crashed" method After some debugging the log texts, main part of the log file I got: 2022-01-08T11:12:12.754916+00:00 heroku[web.1]: Starting process…
2
votes
1 answer

What does Ruby's `Ractor.select` method `move` boolean flag do?

I'm trying to understand the behavior of the move flag in Ruby's Ractor.select method. method signature: https://ruby-doc.org/3.2.1/Ractor.html#method-c-current The description of the function's move flag in the documentation describes the flag in…
sreedev
  • 51
  • 1
  • 5
2
votes
2 answers

How to use HEREDOC to pass as an argument to a method?

Code example: create_data_with( first: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", second: <<~TEXT Aenean vel ex bibendum, egestas tortor sit amet, tempus lorem. Ut sit amet rhoncus eros. Vestibulum ante ipsum primis in…
Colibri
  • 993
  • 11
  • 29
1
vote
2 answers

twilio-ruby stops working after upgrading to ruby 3.1.3

I have been using the twilio api for 3 years to send messages and it worked perfectly. After upgrading from ruby 2.6 to ruby 3.1.3, Twilio is no longer working. We are using twilio-ruby 5.74.2. We are getting the error ArgumentError (wrong number of…
Philip7899
  • 4,599
  • 4
  • 55
  • 114
1
vote
1 answer

Weird behaviour of Array index in Ruby 3.1

I don't know why this is happening in my ruby, but do you see the same behaviour? 3.1.2 :001 > ["url", "label:from", "label:type", "label:batch", "note"].index('url') => nil 3.1.2 :002 > ["url", "label:from", "label:type", "label:batch",…
den
  • 51
  • 2
  • 8
1
vote
1 answer

Selenium Grid 4, How to match a particular pattern capability in ruby 3.x.x

I'm unable to match the custom capabilities in ruby code for selenium grid 4 nodes. As per this documentation: https://www.selenium.dev/documentation/grid/configuration/cli_options/#matching-node-a I've tried to do the same thing in ruby like…
0
votes
0 answers

Get date of first day of 'Week/Year' format in Ruby. where week starts from Saturday

Is there an in build function to extract the date of the first day from "week/year" format in rails where weeks start on Saturday. example: "01/2020" should give Sat, 04 Jan 2020 We can get the same for the weeks that starts with…
Akansha
  • 116
  • 6
0
votes
0 answers

Unable to install Ruby 3.1.4 via rbenv on AlmaLinux/CentOS 7

I am trying to install Ruby 3.14 on an AlmaLinux distrubtion via rbenv. Seems the build and the compiler are not compatible. Has anybody seen this issue before and possibly found a solution? It is strictly speaking not an issue with 3.1.4 fails…
smile2day
  • 1,585
  • 1
  • 24
  • 34
0
votes
1 answer

Ruby IPAddr class accepting wrong IPv6 address string

We are middle of upgrading ruby versions v2.7.3 -> v3.1.3 One of our test cases are failing related to valid ipv6 address string, check the following # ruby 2.7.3 IPAddr.new('fe80::85e:7530:69ec:9074%en0').ipv6? => IPAddr::InvalidAddressError…
Md. Farhan Memon
  • 6,055
  • 2
  • 11
  • 36
0
votes
0 answers

Track Down Ruby-on-Rails "RunTimeError"

I am new to this Ruby-on-Rails stuff and cannot figure out who to resolve this "RunTimeError" When I run the following command from /var/www/discourse, sudo -u www-data RAILS_ENV=production $ruby_path/bundle exec rake db:migrate --trace ...part way…
user371793
  • 41
  • 1
  • 6
0
votes
1 answer

ActiveRecord Query replaces id with null

I have upgraded the rails app from 5.X to 6.X and ruby 2.5.X to 3.1.2 and also my application was using apartment gem which has not support for rails 6 so i have used ros-apartment as suggested but still it is not working. User.find 1 User…
0
votes
2 answers

Is it possible to pattern match on a hash value to get the hash key in Ruby 3?

This is a question about pattern matching in Ruby 3. I have a hash: h = { x: [1, 2, 3], y: [11, 12, 13], z: [100, 101], } Given an integer (for example, 13), I'd like find the hash key whose hash value contains the integer (:y in the…
Zack Xu
  • 11,505
  • 9
  • 70
  • 78
1
2