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
1
vote
1 answer
Ruby 2.4 module name conflict with my model class name
I'm upgrading Ruby's version from 2.3.8 to 2.4.4 on Rails 5.2.3.
When I start the application I get this error:
app/models/warning.rb:1:in `': Warning is not a class (TypeError)
when called on console:
Warning.class => Module
But in fact it…

user6776
- 37
- 8
1
vote
2 answers
Does Ruby's Regexp interpolation leak memory?
I've got code that is leaking memory in a Sinatra app on Ruby 2.4.4, and I can sort of reproduce it in irb, although it's not totally stable, and I'm wondering if others have this same problem. It happens when interpolating a large string inside a…

mltsy
- 6,598
- 3
- 38
- 51
1
vote
0 answers
How to manage rails style.css and style.scss both present in rails project
Hi My I am using the Rails 5.2.1
ruby 2.4.0
I have style.scss and style.css both files present in the rails project.
The application is working fine on the Development environment.
But in the production on Nginx server after precompiling the assets…

vidur punj
- 5,019
- 4
- 46
- 65
1
vote
1 answer
Why faraday dependency not being resolved by bundler?
I added gem 'bitfinex-rb' in rails gem file, When I do bundle install, I got below mentioned error:
Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (= 0.14.0)
In Gemfile:
bitfinex-rb was…

codemilan
- 1,072
- 3
- 12
- 32
1
vote
2 answers
Why validation exists even no validation rule declared?
invitation.rb is as:
class Invitation < ApplicationRecord .
belongs_to :sender, class_name: 'User'
belongs_to :subscription
end
subscription.rb is as:
class Subscription < ApplicationRecord
has_many :payments, dependent:…

codemilan
- 1,072
- 3
- 12
- 32
1
vote
2 answers
Ruby on Rails 5.1.4 CSS files not found it gives missing error. in browser's console and heroku logs
I am using a themeforest by asbab. I've added them to my ruby on rails app. It works perfectly fine in localhost. But when uploaded to heroku, the css files are not found. It wont load all the css files.
Ruby : 2.4.0
Rails: 5.1.4
Heroku…

Ronak Bhatt
- 23
- 4
1
vote
1 answer
Why does defining a method called ! break IRB?
IRB appears to have strange behaviour when defining a method called !.
To reproduce this, enter the following into IRB:
def !
puts "foo"
end
Upon creating the method, IRB infinitely prints foo:
irb(main):001:0> def !
irb(main):002:1> puts…

Aaron Christiansen
- 11,584
- 5
- 52
- 78
1
vote
3 answers
How do I split a token from the end of my string?
I want to separate a string into two parts if a token from an array is found at the end of the string. I have tried this:
x = "Canton Female"
GENDER_TOKENS = ["m", "male", "men", "f", "w", "female",…

Dave
- 15,639
- 133
- 442
- 830
1
vote
1 answer
Change Date default to_s format in the scope of library
I want all of the dates in the scope of the library to have a common format ("%d.%m.%Y") instead of the default ("%Y-%d-%m"). For now I have come up with 3 different approaches (and I don't like any of them) to accomplish what I want. All of them…

potashin
- 44,205
- 11
- 83
- 107
1
vote
2 answers
How do I get the results of a split returned in the order in which they occur in the split?
I'm using Ruby 2.4. I'm trying to split elements in an array. What I would like is to form to equivalent arrays with the results of my split. I would like the first part of the split to be the first array and the second part of teh split to be…
user7055375
1
vote
1 answer
Sending emails during Capistrano deployment using Rails 5, Ruby 2.4, and Capistrano 3
Capistrano 3.7.2, Rails 5.0.2, and Ruby 2.4.0 to be specific. The error I get occurs after Execute load:defaults:
** Execute load:defaults
cap aborted!
NameError: uninitialized constant…

Maltiriel
- 793
- 2
- 11
- 28
0
votes
0 answers
unexpected keyword_rescue, expecting keyword_end (SyntaxError)
I'm facing this issue while using 'smarter_csv' gem in a ruby CLI script using version 2.4.1.
The gem is installed successfully but upon using, I get…
0
votes
2 answers
Is there a way to take an array and modify each individual element in a unique way using a single line of code?
I'm attempting to modify a variable string in Ruby 2.4 that contains both a number and a unit of measurement. My goal is to take the following string, round the numeric portion, and capitalize the unit portion:
my_string = "123.456789…
user16452228
0
votes
1 answer
Ruby on rails, how to remove white-space from japanese word?
I am trying to remove white-space from japanese word.
input "かいしゃ(会社)"
output "かいしゃ(会社)"

vvp.rb
- 27
- 4
0
votes
1 answer
Guard not executing spec/features of capybara test
My guard file is edited for executing the test cases written inside the spec/features so if there is any change inside the controller or model it will execute all spec/features tests:
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) {…

vidur punj
- 5,019
- 4
- 46
- 65