229,317 questions
0
votes
0
answers
9
views
Failure/Error: choice = gets.chomp.upcase NoMethodError: undefined method `chomp' for nil [closed]
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 =...
0
votes
0
answers
8
views
Ruby 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 run
bundle update rexml
I then ran
gem list | grep rexml
rexml (3.3.9)
and checked the version running in the ...
0
votes
0
answers
24
views
Ruby 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 ...
0
votes
1
answer
22
views
Posting with headers
I have simple post using net/http.
uri = URI("https://example.com")
params = {title: 'foo', body: 'bar'}
Net::HTTP.post_form(uri, params)
Now, I need to add a header, but I can't find a way ...
0
votes
1
answer
17
views
Deprecation Warning: "Bolding log text with a positional boolean is deprecated" when running Rails tests with Rspec
When running my tests in a Rails application, I see the following deprecation warning multiple times:
DEPRECATION WARNING: Bolding log text with a positional boolean is deprecated and will be removed ...
0
votes
0
answers
52
views
Missing C-allocation functions inspite of include stdlib.h in old C++ - Ruby program
I am trying to get this PersonalRapidTransit simulation to run. It was written by John Lees-Miller 13 years ago, so assume that it uses C++11 or older. Unfortunately the Github repository is closed so ...
0
votes
0
answers
31
views
I am yielding to an ERB file, but it is rendering in plain text and not HTML. Why?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0&...
0
votes
0
answers
26
views
ruby-inotify unexpected tilde ~ added to some reported file names
I have a ruby script that runs waiting for a scanned pdf document to be uploaded to a path and then does some additional processing and notifications. The scanner is a Canon ImageRunner scanner using ...
0
votes
0
answers
32
views
Rails attachment delegation to another model optionally
I have two models InInvoice, Disbursement. Both are associated: InInvoice optionally belongs_to disbursement. Both have a has_one attachment called att.
InInvoice is supposed to delegate att calls to ...
0
votes
1
answer
34
views
What's the purpose of "[0]" appended to a match method in ruby?
I was going through the Exception Handling chapter of the Bastards Book of Ruby and I came across a bit of code in between the lines of:
while 1
puts "Enter a number>>"
num = ...
0
votes
0
answers
21
views
Struggling to install ruby and rails because of OpenSSL?
Just for some context of my system:
Apple m4 chip
Just switched from an older intel laptop to a m4 chip in case that makes any difference.
Using rvm to install ruby
Steps I took:
`rvm install 3.3.6 ...
-1
votes
0
answers
61
views
How to edit files and debug code inside rails console [closed]
After I am inside rails console, I modify the file two ways
by doing vim <file_location> and saving file. This reloads file into console.
Paste the entire file in rails console, this override ...
0
votes
0
answers
53
views
rails validation destroying nested record
I have a Plot class with a nested MaterialInfo class populated via one form.
class Plot < ApplicationRecord
has_one :material_info, dependent: :destroy
accepts_nested_attributes_for :...
0
votes
1
answer
30
views
Rubymine doesn't recognise .jb file types in New View File dialog [closed]
In rubymine, when working on a rails project, if i got the a controller action, in the left margin there is a file icon, when i click it it opens either the associated view for that action, or a ...
0
votes
1
answer
40
views
pins controller uploading duplicates of image rails
I'm stuck uploading 2 copies of each image
i guess im gong to add a way to remove sepearte images but for now how do i stop duplicates?
some help getting through the double vision would help. im ...
0
votes
0
answers
46
views
Rails polymorphic association with flat namespace [closed]
I am upgrading a Rails app where the database is used by multiple applications. There is a Transaction model that is now in a namespace Engine. However the item_type is Book and not Engine::Book.
...
0
votes
0
answers
28
views
Checking for errors in Ruby Net::HTTP::Get or Post when streaming the response?
I'm trying to read a streaming request using Net::HTTP. I get the response and check that I have a 200. What happens if the stream errors while I'm processing chunks? How do I get that error?
...
-2
votes
0
answers
46
views
submitting the Edit Form Via PUT request [closed]
We need to update our form to submit via a PUT request. But as we've discussed, browsers only directly support POST requests.
Update the HTML form to submit via a POST request.
<p>Please enter ...
0
votes
0
answers
40
views
rvm loading core modules not working over ssh command [closed]
I have a ruby script that's running just fine on a remote server if it's run locally. ruby /path/script.rb. It includes a few core extensions being required, require 'Time'; require Open3`. Running ...
-1
votes
0
answers
25
views
Update Mac to point to Ruby Version 3.3.6 [duplicate]
I have been losing my mind on this for quite a while. I have Macbook with Sequoia 15.1.1.
I installed Ruby with Homebrew.
When I enter ruby -v it shows the version that comes with Mac 2.6.10.
When I ...
0
votes
0
answers
44
views
How to Link Metrics Data with Traces Using Exemplars in Ruby?
I'm working on linking metrics data with traces, and I discovered that Exemplars can be used for this purpose.
In Go lang, I can achieve this with the following configuration:
go
if span.SpanContext()....
0
votes
1
answer
40
views
How to install install Msys2 package icu package for ruby gem?
I am trying to install the Ruby gem github-linguist. I am on a Windows machine, and I have tried executing gem install github-linguist via the Msys2, Mingw64, and the regular Windows command shell. I ...
0
votes
0
answers
24
views
How to enable DevTools remote debugging on chrome
Trying to run selenum with ruby and getting below error
DevTools remote debugging is disallowed by the system admin
require 'selenium-webdriver'
class SeleniumPoc
def setup
#options = Selenium::...
0
votes
0
answers
27
views
Ruby environment in Dockerfile using RVM - FROM Ubuntu [duplicate]
In my small Dockerfile:
FROM ubuntu:24.04
SHELL ["/bin/bash", "-c"]
RUN apt update
RUN apt update && apt install -y gnupg2 curl software-properties-common build-essential ...
0
votes
2
answers
51
views
Ruby code not showing up after I run it on VSCode?
I've been trying to learn Ruby programming language from the tutorial of freecodecamp but found out that Atom is basically dead. So I decided to use VSCode, everything goes well until I get to the ...
0
votes
0
answers
27
views
MacOS Cannot Install Jekyll
I can't install jekyll. I'm on MacOS 13.6.6. I've tried xcode-select --install and xcode-select --switch /Library/Developer/CommandLineTools as well as gem update --system. Nothing has worked and I ...
0
votes
1
answer
67
views
How to extract inline calculation when working with enumerables in Ruby?
I am trying to make a FizzBuzz in Ruby based on an enumerable. It works when I inline the calculation:
numb_array = (0..100)
numb_array.select { |numb|
if numb % 2 == 0 && numb % 3 == 0
...
0
votes
0
answers
50
views
Ruby active_record-acts_as gem issue with joining for child and parent class
class Product < ActiveRecord::Base
actable as: :as_product
end
class Car < ActiveRecord::Base
acts_as :product, as: :as_product
end
class Truck < ActiveRecord::Base
acts_as :...
-3
votes
0
answers
35
views
Rails database structure for multiple Projects in productive [closed]
we are currently on GKE and have a HA database for each rails project (service). But now we want to hand over GKE to Kamal. And there I was wondering if it is more usefuller to use maybe 3 databases ...
1
vote
1
answer
82
views
Inconsistent ruby case statement behavior with trailing commas and assignments
Stumbled into a weird error, and I'm curious if anyone can explain this inconsistency or if I should send this to the ruby team as a proper bug. I'm currently using ruby 3.2.2.
Take this script as a ...
0
votes
0
answers
30
views
Rails activerecord-import not work with unique key
model
class User < ApplicationRecord
validates :name, uniqueness: true
end
schema
create_table 'users',
force: :cascade,
charset: 'utf8mb4',
collation: '...
0
votes
0
answers
43
views
FrozenError in colored2 gem while running pod install in CocoaPods 1.16.2
I'm encountering a FrozenError when trying to run pod install with CocoaPods 1.16.2. The error occurs during the execution of the colored2 gem, specifically in the ascii_decorator.rb file. The error ...
-4
votes
1
answer
54
views
What is causing NoMethodError?
I wrote this code for an exercise in pentesterlab:
require 'httparty'
require 'base64'
URL = 'http://ptl-a4b5e023-f4db1f7c.libcurl.so/'
def login(username)
res = HTTParty.post(URL+'login.php',body:{...
0
votes
2
answers
47
views
How to setup Eclipse IDE for Ruby projects under Linux [duplicate]
This question already exists here and here, but I was advised to open a new one.
For me on Ubuntu 24, the text editor fails to show anything, showing the error:
org.eclipse.core.runtime.CoreException: ...
0
votes
1
answer
90
views
Simple Table of Contents in Rails is not working as intended
I had this thought of a simple Table of contents in Rails. I have created a new Rails 8 app, worked. I installed action text. Scaffold'ed out a post model with title and body. Body has the rich text ...
0
votes
1
answer
22
views
How to set up a Lambda Layer for Ruby's mysql2 library?
I've been trying to set up a Lambda Layer for my Ruby Lambda function but I can't make it work for some reason.
I've followed AWS' tutorial on creating (https://docs.aws.amazon.com/lambda/latest/dg/...
0
votes
0
answers
11
views
Labels in yEd when import file.graphml with Ruby
I have a problem.
I have the following code in Ruby, which creates a .graphml file from a file.json.
require 'nokogiri'
require 'json'
require 'rexml/document'
# Método para leer y parsear un archivo ...
0
votes
0
answers
32
views
PDF spec and PADES, adding images after signing to the document without invalidating previous signatures
I have a PADES document that was digitally signed with a certification signature. Also a DocMDP was added with level 2 (form filling and signing) permissions.
Additional signers can sign the pdf and ...
0
votes
0
answers
68
views
PG::UndefinedTable: relation "csv_uploads" does not exist error despite migrations running successfully
I'm encountering an issue where I receive the following error in my Rails application:
vbnet
Copy code
PG::UndefinedTable: ERROR: relation "csv_uploads" does not exist
LINE 10: WHERE a....
1
vote
1
answer
109
views
Make interactive ruby REPL display results for consecutive commands, not only the last?
If I run this
a = "hello"
b = "world"
a
b
in ruby
irb(main):007> a = "hello"
=> "hello"
irb(main):008> b = "world"
=> "world"
...
-3
votes
0
answers
52
views
Trying to upgrade from Ruby 2.7.4 - 3.3.5 using Ansible & Packer
I'm new to Ansible and Ruby but I've been tasked with creating a new AWS AMI using Packer and Ansible.
I have updated the following application.yml from version 2.7.4 to 3.3.5 and the build fails.
...
0
votes
0
answers
48
views
How to make HTTP connection to an IPv6 address in Ruby?
I am trying to perform a POST call to a REST service hosted on IPv6.
require 'ipaddr'
require 'json'
require 'net/http'
require 'base64'
require 'uri'
request_uri="https://[2002:cafe:cafe:cafe:...
2
votes
1
answer
50
views
Ruby namespace flattening gotchas?
I must use a ruby library that looks like it was written by a java developer because the namespaces are so looooooonngg. And I have to use a lot of the classes in the namespaces.
I would like to make ...
0
votes
0
answers
32
views
Problem creating Issue with jira-ruby Gem
I am testing out using jira-ruby and creating an Issue in Jira. However, when I attempt to create an issue, I receive this error:
/Users/xxx/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jira-ruby-2....
0
votes
0
answers
104
views
Brew on M3 Mac with Sequoia thinks the right Ruby is the El Capitan/Intel one
Upgraded a Mac from an Intel model to an M3 (ARM) one, migrated the files and settings. The ARM Mac is running Sequoia (15.1.1) As it always happens, the migrated Homebrew packages and brew itself ...
2
votes
1
answer
42
views
The yield command will not work as it should in Ruby
In the book "The Well-Grounded Rubyist" edition 3 on page 185 is the code. And the code for my_each is on page 183. It also involve code on page 184:
Class Array
# Put the definition of ...
0
votes
1
answer
57
views
gem install psych fails on Ruby 3.3.4
I need to have 2 versions of ruby installed for separate projects (2.6.6p146 and 3.3.4).
When I change ruby by using export PATH="...:/c/Ruby33-x64/bin:...", ruby -v reports 3.3.4.
However, ...
0
votes
1
answer
18
views
Ruby aws-sdk gem - how to list knowledge base sources?
I have several AWS Bedrock knowledge models. I know their IDs.
Looking to a way to read/work with KB sources - for example - run sync process.
Trying to use gem 'aws-sdk-bedrock' but it looks like it ...
0
votes
0
answers
18
views
Bundle install stuck on devise_saml_authenticatable
Im trying to run bundle install --verbose on an existing ruby on rails project.
But the bundle is hanging on this section
1: devise_saml_authenticatable (1.9.1) from /Users/'username'/.rbenv/versions/...
1
vote
0
answers
41
views
Tying to read a URL with Ruby and open-uri is giving a 403 error
I have a process that has been running successfully on a Raspberry Pi for years that is now suddently failing. I am scraping a website so I am passing a URL to open-uri and then parsing it with ...