ruby Questions
1
I invoke Ruby from my shell script like this:
ruby -n -e "print if %r($fromre)...%r($tore)" "$@"
Since Ruby 2.6, I get the warning
warning: flip-flop is deprecated
So it seems that i have to b...
3
Solved
I have the following Time object:
[8] pry(#<#<Class:0x007f928f12f560>>)> display_num
=> 2015-02-19 09:00:00 -0600
[9] pry(#<#<Class:0x007f928f12f560>>)> display_nu...
Antimonyl asked 2/2, 2015 at 22:12
5
I am having issue in installing ruby 2.7.1
I am getting this error:
Error running '__rvm_make -j8',
please read /Users/luqman/.rvm/log/1690926841_ruby-2.7.1/make.log
There has been an error while ...
Outspeak asked 1/8, 2023 at 22:13
3
Solved
Full stack trace:
/Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- ffi (LoadError)
from /Users/galharth/...
Brenza asked 14/7, 2016 at 18:36
6
When I try to start my Rails server, I get the following error:
$ bundle exec rails s
Your Ruby version is 2.3.7, but your Gemfile specified ~> 2.3.8
I don't understand why that happens thoug...
Uncover asked 30/3, 2019 at 0:28
3
Goal: Upgrade legacy app step by step as recommended by the RailsGuides: Upgrading Ruby on Rails (from ruby 2.3.1 and rails 4.2.2)
Expected result: rake assets:precompile completes successfully wit...
Swordbill asked 8/12, 2022 at 3:55
5
Solved
I'm working on CRM platform.
I would like my users to add, edit and delete custom fields in Client, Contact and Lead objects. Those fields may be plain textfield, list, checkbox, tag etc. Those fi...
Coset asked 10/1, 2017 at 0:36
4
I added the key into heroku config var, but I'm still getting the error.
Is this the correct way? I ignored secrets.yml as I read from other sources that its not a good idea to push this to the pu...
Cassino asked 3/7, 2016 at 7:49
4
Solved
I've gone through a good chunk of this tutorial, and have gotten to the part where functionality for deleting articles is added:
https://guides.rubyonrails.org/getting_started.html
...but whenever ...
Upset asked 10/2, 2022 at 5:9
3
Over the course of our project with multiple developers and styles, we have some tests and code that are commented out. Is there an easy way to find all code that is commented out?
The tool should...
Spirant asked 14/11, 2012 at 23:39
3
Solved
Ruby has a fatal exception, but there is no guidance on how to raise it and I cannot figure it out. How do I raise a fatal exception in Ruby?
Pitapat asked 7/1, 2017 at 5:33
3
I read quite a lot on Google that ruby does not release back memory to the OS and I understand the as well because allocating memory from OS is a costly fair.
Which has led me to ask this
If a de...
Dictate asked 29/7, 2016 at 11:48
2
Solved
I would like to be able to know that my code is run under rspec or not. Is this possible?
The reason is that I am loading some error loggers that would be cluttered with deliberate errors (expect{...
Keane asked 24/7, 2014 at 11:32
7
How can I tell VCR that I want it to completely ignore a spec file?
I've read a post on Google Groups that suggests either allowing real HTTP requests, or turning VCR off explicitly.
What would b...
5
Solved
Im new to rails and trying to internationalize my app with I18n. In the locales yaml file for the spanish version im trying to set up the translations as follows:
es:
categories: "Categorias"
ho...
Alive asked 24/3, 2014 at 14:58
5
Solved
I tried SecureRandom.random_number(9**6) but it sometimes returns 5 and sometimes 6 numbers. I'd want it to be a length of 6 consistently. I would also prefer it in the format like SecureRandom.ran...
Dunigan asked 17/5, 2017 at 17:20
10
def titleize(string)
string.split(" ").map {|word| word.capitalize}.join(" ")
end
This titleizes every single word, but how do I capture certain words I don't want capitalized?
ie) Jack and Jil...
4
Solved
Doing a ruby problem and thinking to myself, there must be an easier way.
I want to split an array at a specified index into two sub arrays. The first sub array containing the numbers up to the s...
Aldehyde asked 10/3, 2017 at 2:32
5
Solved
I understand that this issue has a ton of answers on stack overflow (and other sites) but none of them seem to work for me. Here is where the issue arises. When I tried to run my server, this error...
Farias asked 30/11, 2020 at 5:36
1
Would like to exploit the following behaviour in Ruby
ary = Array.new(5) { |i|
[i, j=2*i, k=j+1]
}
p ary #> [[0, 0, 1], [1, 2, 3], [2, 4, 5], [3, 6, 7], [4, 8, 9]]
It works for my purposes, b...
Higginbotham asked 11/7, 2020 at 20:52
5
Solved
How can I offset this array so it only outputs every ten numbers?
(0...40)
[10,20,30,40]
4
I would like my background jobs to run inline for certain marked tests. I can do it by wrapping the test with perform_enqueued do but I'd like to just be able to tag them with metadata and it happe...
Neocolonialism asked 17/5, 2016 at 16:24
2
I have a Rails 7 application. After some development I see that Turbo (Hotwired) creates too many issues and I don't need it for this application.
Is there any way to remove Turbo completely from a...
Professionalize asked 14/1, 2022 at 18:14
5
Solved
Learning about Ruby blocks here. What is the point of having block local variable in this example:
When you can just do the below instead? The x in the block is already going to have its own scop...
2
I am trying to debug code in Rubymine. It looks like we need to install debase first. I tried to search in google but could not find any solution.
$ ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff2...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.