How do I get all Sundays between two dates in Ruby?
I'm working on a form where the user enters a date range and selects from a list of checkboxes a day/days of the week i.e Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and saturday.Once the form...
View ArticleRuby application deployed on Ubuntu 18, with issues with passenger and apache
This is what I have, how can I fix it? I have to say that I am using Apache to host my website, and I uninstalled them and installed Passenger but the error persists, what can I do? Or if the error is...
View ArticleRuby gems update but old versions still present
I am trying to update rexml to 3.3.9. I updated the version in the Gemfile and runbundle update rexmlI then rangem list | grep rexmlrexml (3.3.9)and checked the version running in the applicationruby...
View ArticleBreak out of a begin/end block early
I want a way to exit a begin/end block while still assigning the variable that its result is assigned to.def foo @foo ||= begin puts "running" return "leaving early" if true # would be some sort of...
View ArticleWhat does __FILE__ == $PROGRAM_NAME mean in ruby? [duplicate]
I have stumbled across this syntax while reviewing a code in Ruby. The code is:if __FILE__ == $PROGRAM_NAME #some code...endI suppose __FILE__ is a variable that gets me the name of the file I am...
View ArticleFailure/Error: choice = gets.chomp.upcase NoMethodError: undefined method...
I have little experience in ruby development and I can't understand why this error occurs when running tests. Can you help me?class CashMachine START_BALANCE = 100.0 def initialize @balance =...
View ArticleError Pod install on flutter (Cocoapods, macOS Sequoia 15.1.1)
When running pod install in ios directory it shows error.MacOS: Sequoia(15.1.1)Xcode 16.1Flutter doctor responseAnalyzing dependenciescloud_firestore: Using Firebase SDK version '11.4.0' defined in...
View ArticleHow can I accept bank account payments using Stripe API for ACH payment
The application that i am working on is accepting payments via card. The requiremnt is to acccept payment via bank accounts(ACH payments)I tried using the payment method option as us_bank_account, but...
View ArticleSystem() command in Ruby doesn't wait for child process to end
I'm trying to write a Ruby script that goes into each sub-directory in a directory, and then executes several commands. I am using the System() command to execute some of them. Based on the...
View ArticleSonarCloud CI can't find source files for Ruby / SimpleCov coverage
tl;dr - SonarCloud CI on GitHub actions warns that it can't find any of the source files with coverage reported, despite confirming that the files are in the docker filesystem at the path reported.I...
View ArticleNet/http posting nested parameters
I'm making a post request using the built-in net/http ruby library, and I need to update it to post nested parameters.Currently, I get (from another object) the params in the following format:{ :user...
View ArticleHow to change the temporary directory (tmp) for a Rails app to a custom path?
I'm trying to change the tmp directory used by my Rails application to a custom directory, but so far, nothing I've tried has worked.I’ve followed several suggestions, such as setting the TMPDIR...
View ArticleWhat is the point of Object#presence in Rails?
In the Rails docs, the example provided for the Object#presence method is:region = params[:state].presence || params[:country].presence || 'US'But isn't that just equivalent to:region = params[:state]...
View ArticleBest strategy and overall probability of success estimation for getting dated...
This question has been edited in reaction to the helpful comments, thanks!I am trying to get this PersonalRapidTransit simulation to run. It was written by John Lees-Miller 13 years ago. Unfortunately...
View ArticleExplanation of Ruby's block and proc behaviour
I am learning Ruby and was looking at the documentation of Array#maphere, and it says the the syntax is as followsmap {|element| ... } → new_arraymap → new_enumeratorBut we are able to do...
View ArticleIs there a way to make Ruby HTTPI use IPv6?
I have an existing test framework that uses Ruby's HTTPI library to make HTTP calls, and I'm trying to add a test for IPv6 (dual-stack) support. The code looks something like this:def...
View ArticleThe issue to write string in double quotes in the CSV
I am going to write a string in double quotes in the CSV using csv gem.CSV.open(source_filename, "wb") do |csv| csv << ["NAME", "AGE"] csv << ["Oleg", 15]endThe result isNAME,AGEOleg,15What...
View ArticleRuby: Check if string contains substring and nothing else
Users can upload a CSV file to my service. The CSV needs to have two column names and nothing else. One column needs to be "email" and the other "credit" and nothing else can be in those column names,...
View ArticleRails - a way to check the last line while using smarter_csv gem
I am using smarter_csv gem to parse a large CSV file on Heroku.SmarterCSV.process(file_name, { chunk_size: 10, headers_in_file: false, user_provided_headers: user_provided_headers }) do |chunk|...
View ArticleHow to convert array of ActiveRecord models to CSV?
I got an array of ActiveRecord models that I wish to convert to a CSV. I tried researching gems like FasterCSV, but they just seem to work with strings and arrays, not ActiveRecord models.In short, I...
View Article