in Ruby why does ",".split(",") return [] instead of ["",""] (which would be...
$ irb3.0.0 :001 > ",".split(",") => [] # really? the input string has two empty substrings delimited by a ,3.0.0 :002 > ",".partition(",") => ["", ",", ""] # partition() handling of empty...
View ArticleProblem with Foreman --- > engine.rb:201:in `kill': Invalid argument...
I am trying to start a ruby on rails server along with React JS; in my procfile.dev I have the following:web: rails server -p 3000js: yarn build --watchBut when I try to run foreman I get this error :$...
View ArticleHow to understand the difference between class_eval() and instance_eval()?
Foo = Class.newFoo.class_eval do def class_bar"class_bar" endendFoo.instance_eval do def instance_bar"instance_bar" endendFoo.class_bar #=> undefined method ‘class_bar’ for...
View ArticleWhy does bash keep showing my ruby version in the prompt?
I was using ruby for the first time yesterday and I installed some packages / gems without much awareness and now bash keeps showing my ruby version 2.4 everywhere I go. How do I remove it?
View ArticleRails Exception No Such Table Exists
I used rails generate to scaffold a ProjectType table and a ProjectGroup table that references project type. I created a project type successfully through the browser, but when trying to create the...
View ArticleRails Mongoid has_many query not using foreign_key
I am using mongodb for first time. I have below modelsclass Legacy::User include Mongoid::Document has_many :customers field :username, type: Stringendclass Legacy::Customer include Mongoid::Document...
View ArticleProblem with mysql2 installation on Sonoma MacOS
I'm in trouble with my mysql2 installation on Sonoma 14.3.1. Got already installed mysql via brew, as well as openssl (OpenSSL 3.3.0 9 Apr 2024) and zstd (Zstandard CLI 64-bit v1.5.6) libraries. X-code...
View ArticleUnable to run shopify theme dev command due to Ruby and Bundler issues on...
I am trying to set up a Shopify theme development environment on my Windows 11 machineI am trying to set up a Shopify theme development environment on my Windows 11 machine. However, I am encountering...
View ArticleHow can I get the effect of constructor overloading in Ruby? [closed]
I am creating a program to imitate the "Hangman" game according to the assignment in the Odin Projecthttps://www.theodinproject.com/lessons/ruby-hangmanAs you can see in the snippet below, the player...
View ArticlePattern matching in ruby with hashes
When i was learning about pattern matching in ruby, i came across this issuehash = { name: 1, age: 21, location: "NYC" }case hashin {name: String => x, age:y, location:z} puts "Name: #{x}, Age:...
View Articlesyntax error, unexpected ')', expecting '=' (SyntaxError)
Letters1 = Array["A","B"]password1 = nilwhile password1 != "A" letter1 = Letters1[rand(0...2)] letter2 = Letters1[rand(0...2)] password1 = (letter1) File.write("passwords.txt",password1) puts...
View ArticleWhy ngrok send me a 403 Forbidden
I try to work with a webhook to get a JSON, I read that I should install ngrok because webhooks do not work locally, so I installed ngrok, and tried to follow this small tuto :...
View ArticleHow to use Arel::Nodes::TableAlias in an initial where statement
I got stuck on this and for sure it's easy, but I just cannot find the solution in the docs.I have some tree structure and the child where clause that I have to filter with an "exists" sub...
View ArticleRuby on Rails, How to make a controller render different page without redirect?
Let's say we have the following pagesclip/show/111image/show/222sound/show/333where 111,222 and 333 are the IDs for different contributionsI developed a new controller called "show" that will detect ID...
View ArticleShopify: Error coming from `bundle install`
I am getting error.I am trying the Shopify Remix app. The error occurs when I add the extension in my app and run Shopify app dev.Any idea how to resolve this?Here is error in the textShutting down dev...
View Articledocker: Error response from daemon: failed to create task for container:...
I am trying to dockerize a rails app but I am getting this errordocker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc...
View ArticleJavaScript loading multiple times Ruby on Rails application
I am using the google maps JavaScript API in a ruby on rails application. I have a database of locations, and I am trying to show a map of each location in the "show" view. I loaded the google maps api...
View ArticleRuby: calling exit! in at_exit
I have a daemon, written in Ruby, part of a Rails project and from which it uses some of the models (and so ActiveRecord). It sits waiting for files to arrive, and when they do it extracts data from...
View Articlehow to resolve pending migration error in rails 7
I have created a migration in which i mistakenly duplicate the columns of "created_at" , now my screen is displaying this error, after when i remove the duplication, the errror was also same before...
View ArticleHow to solve OpenSSL error during install of ruby 3.1.3 for Mac
I'm getting the below error when I try to install ruby-install ruby 3.1.3 (following instructions to install Jeykll). I think the issue is this link says ruby versions greater than 3.1 require OpenSSL...
View Article