Questions tagged [ruby-2.4]

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

73 questions
46
votes
1 answer

What do these RubyInstaller 2.4 components do?

A few days ago, RubyInstaller 2.4 for Windows was released. Upon installation, it asks me the following question. _____ _ _____ _ _ _ ___ | __ \ | | |_ _| | | | | | |__ \ |…
Grilse
  • 3,491
  • 2
  • 28
  • 35
19
votes
1 answer

After Ruby 2.4 upgrade - error while trying to load the gem 'uglifier' (Bundler::GemRequireError)

I've just upgraded my App to use Ruby 2.4.0 without any errors during the bundling process. When I try to start my server, however, I get the following error: There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError) Gem…
Severin
  • 8,508
  • 14
  • 68
  • 117
19
votes
4 answers

Is it possible to run a Rails 4.2 app on Ruby 2.4?

I want to try out a Rails 4.2 app on Ruby 2.4. However, when I try doing it, I get errors about the json gem version 1.8.3 failing to install. Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory:…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
8
votes
2 answers

Wait for a thread to die in Ruby

It appears that, in Ruby 2.4 and 2.5, threads don't die as soon as you invoke #kill on them. This code snippet will print Not dead a few times: thread = Thread.new { loop {} } thread.kill puts "Not dead" while thread.alive? I'd like to block…
Aaron Christiansen
  • 11,584
  • 5
  • 52
  • 78
8
votes
1 answer

How does Ruby's max function order duplicates?

I've been looking at the max method in Ruby's Enumerable mixin (v2.4.1). It's a fairly straightforward method, but how it orders items when duplicates are present is a bit confusing. For example: x = [1,2,3,4,5,6,7,8,9] x.max {|a, b| a%2 <=> b%2} =>…
River
  • 8,585
  • 14
  • 54
  • 67
7
votes
0 answers

NoMethodError: undefined method "delete_prefix" String class (Ruby 2.4.1)

I'm using the latest Ruby (version 2.4.1) I see there's a method String#delete_prefix as defined in https://ruby-doc.org/core-2.4.1/String.html#method-i-delete_prefix But in irb, this method doesn't exist for some reason: 2.4.1 :030 >…
Zack Xu
  • 11,505
  • 9
  • 70
  • 78
6
votes
1 answer

Uncaught TypeError: $(...).modal is not a function in rails 6

Getting this error in rails 6, in rails 5 it was a easy fix after updating the application to rails 6, including webpack this error is appear every where I try to close the model inside the js.erb files. My files:…
vidur punj
  • 5,019
  • 4
  • 46
  • 65
5
votes
1 answer

How can I remove non-printable invisible characters from string?

How can I remove non-printable invisible characters from string? Ruby version: 2.4.1 2.4.1 :209 > product.name.gsub(/[^[:print:]]/,'.') => "Kanha‬" 2.4.1 :210 > product.name.gsub(/[^[:print:]]/,'.').length => 6 2.4.1 :212 >…
Surya
  • 2,429
  • 1
  • 21
  • 42
5
votes
1 answer

How to get size of cloned lazy enumerator

We have an Enumerator::Lazy object a = [1,2,3].lazy.map {} #=> :map> a.size #=> 3 a.clone.size #=> nil Does anyone have correct explanation of such behaviour ? I know that size returns size of the…
5
votes
1 answer

LoadError: incompatible library version: bindex/cruby

Ruby v2.4.1 - Rails v5.0.6 After running rake db:migrate, this is the error I'm getting: LoadError: incompatible library version .. /.rvm/gems/ruby-2.4.1/gems/bindex-0.5.0/lib/bindex/cruby.bundle Thanks in advance if you can help!
nope2023
  • 1,668
  • 1
  • 15
  • 28
4
votes
1 answer

best way to organize a long piece of code in ruby refinement block

module Access def last self[-1] end def start_end self[0] + last end end module StringExt refine String do include Access end end using StringExt puts 'abcd'.last # => d puts 'abcd'.start_end When a class being…
3
votes
0 answers

Getting "ruby-2.4.2/lib/ruby/2.4.0/forwardable.rb:157 forwarding to private method" while running rspec

I have upgraded my application from Ruby 2.2.3 to Ruby 2.4.2, Rails version is 5.1.4. I am able to upgrade the application but when I run 'bundle exec rspec' getting too many lines similar to ..... "ruby-2.4.2/lib/ruby/2.4.0/forwardable.rb:157…
Ritesh Kumar
  • 2,183
  • 2
  • 20
  • 32
3
votes
2 answers

Why update_attributes doesn't update an attribute, but update does?

Rails version: Rails 5.1.1 Ruby Version: ruby-2.4.0 [ x86_64 ] Local Server: Puma starting in single mode... * Version 3.9.1 (ruby 2.4.0-p0), codename: Private Caller * Min threads: 5, max threads: 5 * Environment: development * Listening on…
praaveen V R
  • 1,259
  • 1
  • 11
  • 20
3
votes
1 answer

How do I scan every element of an array except one index?

I'm using Ruby 2.4. How do I scan every element of an array for a condition except one index in the array? I tried this arr.except(2).any? {|str| str.eql?("b")} But got the following error: NoMethodError: undefined method `except' for ["a", "b",…
Dave
  • 15,639
  • 133
  • 442
  • 830
3
votes
1 answer

Dynamically include associations for objects in Rails

I am currently developing a small Rails 5 application where I need to pass on an ActiveRecord object to an external service based on certain events. In my model I have defined the following: # /models/user.rb after_create…
Severin
  • 8,508
  • 14
  • 68
  • 117
1
2 3 4 5