troubles with RVM and OpenSSL
Trying to set up a new macbook for a colleague. Not going well. First I install OpenSSL:Heathers-MacBook-Pro:~ heather$ rvm pkg install opensslFetching openssl-1.0.1c.tar.gz to...
View ArticleProcessing 500k records crashes the server. How to batch it?
I have a database table holding 500k records. I need to load these records, do an API call, fetch data from this API endpoint, and save new data back to the database.I tried to do it like this...
View ArticleError installing Ruby with rvm: "__rvm_make -j8"
I was trying to install latest stable Ruby versions (3.1.x, 3.2.x) using rvm. However, the rvm install command of any of those versions fails when compiling Ruby. For instance, when trying to runrvm...
View ArticlePG::UndefinedFunction: ERROR: function array_append(anyarray, anyelement)...
In my application we have few test cases which are configured with GitHub workflow,Even I do have only space related changes on file but still getting below error. Not sure why my specs are still...
View ArticleRuby/Faraday: How to translate and parse response body?
I'm using Faraday gem for API connection. The body of the response from my call looks this way:"\xEF\xBB\xBF{\r\n "uptime": "112795",\r\n "started_at": "2021-32-14 17:32:11",\r\n "version":...
View ArticleWhat is the correct way to install ruby on ubuntu 22.04
There is an issue with installing ruby on ubuntu 22.04 with rvm as it will give you error belowError running '__rvm_make -j8',please read /usr/share/rvm/log/1655413907_ruby-2.5.0/make.logThere has been...
View ArticleCheck if record was just destroyed in rails
So there is record.new_record?To check if something is newI need to check if something is on it's way out.record = some_magicrecord.destroyrecord.is_destroyed? # => trueSomething like that. I know...
View Article"I'm getting such an error: #
I'm new to Ruby on Rails and I couldn't understand the reason. Can you help me? I'm new to Ruby on Rails and I couldn't understand the reason. What does '<=>' mean in Ruby on Rails? The problem...
View ArticleRuby: unless vs if not
I find myself preferring if not rather than unless. Is there a proper way to write that sort of condition? How do people generally feel about unless?
View ArticleRuby add/subtract seconds, minutes, hours only
How can I start with a HH:MM:SS Ruby string like "00:00:08" and combine it with "-00:00:06" to get the difference, which would be "00:00:02" in this case?Anything I try to look up involves converting...
View ArticleRuby quirk: Using 'return' to get a nil value
I am doing a problem at Rubymonk where I have to test if an array is 'nil' before doing an operation (adding to items in the array but that is not really relevant to the question). I notice, however,...
View ArticleCase statement with multiple values in each 'when' block
The best way I can describe what I'm looking for is to show you the failed code I've tried thus far:case carwhen ['honda', 'acura'].include?(car) # codewhen 'toyota' || 'lexus' # codeendI've got about...
View ArticleCan I run a script on multiple Ruby on Rails server instances?
I want to update a class variable @@banners on all of my 10 instances of Ruby on Rails production servers by a single click of button on any one of the server. Is there a way to do this?I have the...
View ArticleHow to find unnecessary variable setup in tests using RSpec?
Suppose I have a set of tests like the following. Apparently, test1 and test2 should be separated so that the preparation of var1 or var2 will not be unnecessary in test2 or test1. Anyway I can use...
View ArticleHow to construct URI with query arguments from hash in Ruby
How to construct URI object with query arguments by passing hash?I can generate query with: URI::HTTPS.build(host: 'example.com', query: "a=#{hash[:a]}, b=#{[hash:b]}")which...
View ArticleStrange bundle update issue: disappearing net-pop (0.1.2) dependency
I have a strange bundle update issue with the dependency of net-pop.I manually updated all gems via bundle update GEM. Everything works so far. My CI builds and tests jobs are green.But:When I now run...
View ArticleChecking if a string is valid json before trying to parse it?
In Ruby, is there a way to check if a string is valid json before trying to parse it?For example getting some information from some other urls, sometimes it returns json, sometimes it could return a...
View ArticleWhy does RSpec Rails generate mailer fixtures?
I executed this command:rails g mailer users/confirmations confirm_emailIt generated this file at spec/fixtures/users/confirmations/confirm_email:Users::Confirmations#confirm_emailHi, find me in...
View ArticleConvert Python to Ruby: Working with Bytes
I'm working on converting a python program over to Ruby, it frequently uses the bytes literal `b'' and I don't know how to port this data type over to it's Ruby equivalent.Specifically I need convert:#...
View ArticleRails 7 devise lockable + paranoid not displaying lock message
In my Rails 7 Ruby 3.2.1 app, I'm using Devise and devise-security gems with the paranoid settings enabled (config.paranoid = true). Since a pentest report arrived on my table, I now need to lock a...
View Article