For issues relating to development in Ruby, version 2.4. If your question applies to Ruby in general, use the tag [ruby].
Questions tagged [ruby-2.4]
73 questions
2
votes
2 answers
Docker: Ruby version upgrade from 2.2.0 to 2.4.0
I am using Ruby version 2.2.0 in my Rails Application and Rails version is 4.2.0.
Currently, Project is built through docker, so I am thinking of to upgrade the ruby version with 2.4.0 version.
I believe I need to change the docker image to upgrade…

Rohit Lingayat
- 716
- 6
- 23
2
votes
2 answers
Bundle install do not work for rails-4.2.6 for bundler 2.0.1
RVM is set on ruby-2.4.0 & I created new application which have version,
gem 'rails', '4.2.6'
I updated bundler using,
gem update --system
gem install bundler
bundle version
# Bundler version 2.0.1 (2019-01-04 commit d7ad2192f)
But I am getting…

ray
- 5,454
- 1
- 18
- 40
2
votes
1 answer
Gem Carrierwave is not allowing application/octet-stream file to upload
using Rails 5.2, ruby 2.4 gem carrierwave
gem 'carrierwave', '~> 1.0'
when I upload with extension mdl and content type: application/octet-stream
It return on file save the following error
["Job data file You are not allowed to upload \"mdl\"…

vidur punj
- 5,019
- 4
- 46
- 65
2
votes
3 answers
Ruby 2.4: How To Speed Up Regexp Initializing Dynamically For Use with .match?
I just read about Regexp.match?('string') for Ruby 2.4 and was very excited to see the results! But when I tried it out in my application, I hardly saw any gains.
str = 's'
Benchmark.bm do |b|
b.report(".match ") { 100000.times {…

ayeezy
- 65
- 1
- 8
2
votes
1 answer
Capistrano using wrong ruby version after rvm update
I have a capistrano 3.4.0 script that has successfully deployed an app for years. However today I updated RVM and am trying to deploy my rails app which I'm upgrading to Rails 5.1.4. Capistrano seems to work well for the first part but then throws…

HelloWorld
- 4,251
- 8
- 36
- 60
2
votes
1 answer
How expensive is generating a random number in Ruby?
Say you want to generate a random number between 1 and 1 billion:
rand(1..1_000_000_000)
Will Ruby create an array from that range every time you call this line of code?
Rubocop suggests this approach over rand(1_000_000_000)+1 but it seems…

Ryan Clark
- 764
- 1
- 8
- 29
2
votes
1 answer
Why are singleton_class objects frozen in Ruby 2.4 but not in 2.3?
We have an app that uses the Sequel gem to connect to a data source, perform some work, and then return a result which has a number of convenience methods attached to the singleton_class of that object. In ruby 2.3, this code is working as…

DaKaZ
- 925
- 1
- 7
- 18
2
votes
2 answers
How do I find the index of the maximum value of an array?
I tried the solution recommended here -- In Ruby, what is the cleanest way of obtaining the index of the largest value in an array?
array = [nil, nil, nil, nil, nil, 0.9655172413793104, nil, nil]
idx = array.each_with_index.max[1]
But am getting…

Dave
- 15,639
- 133
- 442
- 830
2
votes
1 answer
Using FacebookOmniauth in Rails 5
I'm trying to implement Facebook Authentication and I'm stuck.
I exactly followed this guide
https://www.crondose.com/2016/12/guide-integrating-omniauth-rails-5-facebook-login-feature/
and get this error
I, [2017-11-07T00:55:47.114884 #12099] …

Takuya
- 21
- 3
2
votes
0 answers
Rails 5 on Heroku - R14 - Memory Quota Exceeded in Ruby (MRI)
I wrote a small Rails 5 API-only application that I am hosting on Heroku. All the application has to do is to retrieve some Data from a DB (currently less than 5K records) and output it as JSON. After deploying the application and running a couple…

Severin
- 8,508
- 14
- 68
- 117
2
votes
3 answers
In Ruby, how do I check if at least 80% of elements in an array match a pattern?
I'm using Ruby 2.4. How do I check if at least 80% of my elements in an array match a certain pattern? I want to see if each element matches the regex
/\d\d?\s*-\s*\d\d?/

Dave
- 15,639
- 133
- 442
- 830
1
vote
3 answers
Couting of array according to hash key in Ruby
I have an array
data = [{:user=>1399, :job=>10270}, {:user=>2614, :job=>10270},
{:user=>3112, :job=>10270}, {:user=>2614, :job=>10271},
{:user=>1455, :job=>10271}]
Where 1399, 2614, 3112, 1455 are user ids and 10270, 10271 are job…

Mohammad Yusuf
- 23
- 4
1
vote
1 answer
Can I use Ruby 2.4 code in Ruby 3 without getting any error?
I was wondering if I could use codes based on ruby 2.4 in ruby 3 (as in the programs, methodology, syntax and function names). I would like to slowly migrate to Ruby 3, but I would like to know if everything would be stable.
Do I need to download…

Alireza Ghaffarian
- 67
- 12
1
vote
2 answers
How would I remove a nested value from a hash that occurs multiple times
I have a hash which is say,
hash = {"lock_version"=>4,
"exhibition_quality"=>false,
"within"=>["FID6", "S2"],
"repository"=>
{"ref"=>"/repositories/2",
"repository"=>{"ref"=>"/repositories/2",
"within"=>["FID6", "S2"]
}
}
This hash is…

Hannah Baker
- 71
- 5
1
vote
1 answer
Singleton disappears when forking unicorn processes in Rails
I've got a rails app running ruby 2.4.4 using Unicorn as a web server which makes use of a singleton to read from Kafka in a background thread. The idea is to have a single instance of the singleton per unicorn process. So 4 processes, 4 singletons.…

timpwbaker
- 116
- 1
- 8