Questions tagged [ruby-3]

For issues relating to development in Ruby, version 3. 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.0 was released Dec 25, 2020.

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

The official release 3.0 announcement summarizes the changes as:

  • Performance
    • MJIT
  • Concurrency
    • Ractor
    • Fiber Scheduler
  • Typing (Static Analysis)
    • RBS
    • TypeProf
82 questions
0
votes
0 answers

Capybara - assert against string containing HTML entities?

In a page on my Rails 6 app, I have table cells rendered from the database, and sometimes the text in them is rendered with converted fancy quotes or other HTML entities encoded by our own t method, which does this: def t(sanitize = true) …
nimmolo
  • 191
  • 3
  • 14
0
votes
1 answer

Ruby - Check if datetime string is in proper format?

What is a clean way to confirm if a string datetime is in the proper format in ruby 3? example input is: datetime = "2020-02-25T02:57:08.264Z" I looked through the Time class and couldnt find any built in way, so wondering if I may have overlooked…
srisha mo
  • 9
  • 2
0
votes
1 answer

Why am I getting `ArgumentError: wrong number of arguments (given 1, expected 0)` on save?

I have this method that gives me a error ArgumentError: wrong number of arguments (given 1, expected 0) after upgrading to ruby 3.1 at test.save!. def seed_test_program test = TestProgram.find_or_initialize_by( name: "Program", …
0
votes
1 answer

After upgrading to Ruby 3, unable to pass multiple arguments to my "initialize" method

I recently upgraded to Rails 6 with Ruby 3. I have this in a controller my_object = MyObject.new(my_object_params, @header) The object “initialize” method is defined like so def initialize(params, header) super(params) user&.header =…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

How to avoid sending emails in Rails test-env with sendgrid-ruby?

Problem I seem to be facing a stubborn issue with my RSpec tests trying to constantly send emails in test-env despite my configuration should avoid it. Whatever I try it seems to totally ignore it. My environment Rails 6.1.1 Ruby…
Andres
  • 2,099
  • 3
  • 22
  • 39
0
votes
0 answers

facing ERROR: ArgumentError: wrong number of arguments (given 3, expected 2) ruby 3 aruba

after upgrading ruby from 2.7 to 3.0 to 3.1 I am facing fowling issue while running the cucumber test Given a local mode chef repo with nodes 'one,two,three' # features/step_definitions/chef-repo.rb:2 …
0
votes
0 answers

Rails file upload "TypeError: can't dump File"

We are working on updating the ruby version from 2.3.1 to 3.0.2 and related changes. We are facing an issue while uploading a file. I have just set the form of file upload and set upload event without any model connection for testing. Event model…
0
votes
2 answers

Read entire message from a TCPSocket without hanging

I'm putting together a TCPServer in Ruby 3.0.2 and I'm finding that I can't seem to read the entire packet without blocking (until the socket is closed). Edit: There was some confusion on what I was trying to do - my bad - so just to help clarify: I…
Eric Power
  • 132
  • 6
0
votes
0 answers

Rails console doesn't work after update RoR

After update rails to 6.1.4 version and ruby to 3.0.0 and update my Ruby on Rails APP I cant start the rails console either IRB and it doesn't show any error. Tests performed I have installed the IRB version 1.3.5 after uninstall the 1.3.6 default…
0
votes
1 answer

Why is it not possible to combine `...` and named arguments in Ruby 3?

In Ruby 3, the new ... syntax was introduced, allowing constructs like these: def locked_run(...) lock run(...) unlock end This is documented here: https://rubyreferences.github.io/rubychanges/3.0.html After this discussion…
Kalsan
  • 822
  • 1
  • 8
  • 19
0
votes
1 answer

Font-awesome icons not rendering on Rails app

I've already installed it with Yarn and also de font-awesome-rails gem. Also included de CDN on the head tag and import "@fortawesome/fontawesome-free/css/all" on application.js. I'm trying to render the icon, among…
Mik
  • 31
  • 5
0
votes
1 answer

In a gem or lib, where should I create a sub-project that's closely related to a gem?

Let's say, I want to add a code-autogenerator for my gem/library. A code generator won't be a single executive cli file, but it'll contain source code as well as a cli file, and I'll be working on it too along with the main gem. Besides, it'll be…
Kakaraji
  • 53
  • 5
0
votes
1 answer

Is there an alternative for `rack-test` for Ruby 3?

We're using rack-test for our Cucumber specs. We've been trying to migrate over to Ruby 3 for a while now and the current issue is that the Cucumber tests crash due to rack-test using both keyword/positional args in their internal methods. I'm up…
0
votes
1 answer

Searchkick search method argument error after ruby upgrade to 3.0.0

Update ruby version from 2.7.2 to 3.0.0, default Searchkick search behavior stopped working. Error trace: ArgumentError in ProductsAvailabilitiesController#index wrong number of arguments (given 2, expected 0..1) searchkick (4.4.4)…
bmalets
  • 3,207
  • 7
  • 35
  • 64
0
votes
1 answer

How to connect/link Javascript data to rails methods?

I am writing a custom DateTime method to get current web viewer's timezone and set all the time views to his/her timezone. How I get local timezone # index.html.erb <%= get_time( getTimeZone(), entry.created_at) %> # getTimeZone() =>…
axelmukwena
  • 779
  • 7
  • 24