Skip to main content
Filter by
Sorted by
Tagged with
7 votes
1 answer
116 views

Split on regex (more than a character, maybe variable width) and keep the separator like GNU awk

In GNU awk, there is a four argument version of split that can optionally keep all the separators from the split in a second array. This is useful if you want to reconstruct a select subset of columns ...
dawg's user avatar
  • 102k
0 votes
1 answer
36 views

Ruby Regex - Match exactly N backticks with exactly N backticks

I think I have found the solution to a GitHub issue, but it involves a bit of advanced RegEx in Ruby. (I rarely worked with Ruby and I wouldn't call myself a professional in RegEx). The problem is ...
Yousef Marey's user avatar
0 votes
0 answers
12 views

How to setup the ruby debugger in VScode for mounted sinatra code?

My code is present in server A and I have opened the same in Vscode. Same code is mounted on server B where the sinatra app is runnig. Server A doesnt have any gems it is just act as file server ...
Praveenkumar's user avatar
0 votes
0 answers
49 views

popen3 not capturing full output

I have a bash script that takes several seconds to finish running. Because of this, popen3 seems to be cutting off the output, simply capturing the beginning echo statements in my bash script. How do ...
Khanrad's user avatar
  • 139
0 votes
0 answers
17 views

Phusion Passenger + Nginx + Rails App ActionController::RoutingError (No route matches [GET] "/") EC2 instance

Rails 5.x App is deployed to EC2 instance. Phusion Passenger version - 5.1.12 Rails App is working as middle layer for API call. So, a request to API at this will internally calling another API (rails ...
Mansi Shah's user avatar
0 votes
1 answer
41 views

Correct Decimal to Floating-Point using Big Integers in Ruby

I'm trying to implement, for learning purposes, the core part of an algorithm that converts decimal strings to 64 bit floating point numbers. I'm using the explanation from this page as a guide: https:...
João Pires's user avatar
0 votes
0 answers
16 views

Puppet module for uninstall a software [closed]

I need to remove seafile and seafile gpg on my debian machines, I think modify the puppet module for install seafile. class remove_ seafile {    case $facts['os']['distro']['codename'] {       ...
valentingrosse's user avatar
0 votes
1 answer
67 views

Ruby gsub capturing groups

This is my input (stored in content variable): <p>some text</p> [image=content_001]Some alt/legend text[/image] <div>some div</div> This is my desired output: <p>some ...
Daniel Costa's user avatar
0 votes
0 answers
34 views

Association with Composite Primary keys in rails

I was reading the Association with Composite primary keys part on rails docs I have 3 questions 1- Why are the names of the foreign keys different in the 2 tables shouldn't they be the same for e.g ...
Student CZ's user avatar
0 votes
1 answer
33 views

RSpec error with expecting DateTime value to be_within a duration of a ActiveSupport::TimeWithZone value

Why does the following test give me a TypeError: expected numeric error: it { expect(DateTime.now).to be_within(1.second).of Time.zone.now } but this test does not? it { expect(DateTime.now).to ...
aarona's user avatar
  • 37k
0 votes
1 answer
25 views

Puppet error Unknown variable: 'ssh_user' for custom resource type in a custom module

I am seeing the following error when my Puppet agent is attempting to retrieve the configuration from the Puppet Server (v8), all running on Redhat OS: Error: Could not retrieve catalog from remote ...
Confounder's user avatar
0 votes
0 answers
29 views

Can't Render Emojis Using MiniMagick in Ruby on Rails

Could you please help me with generating images that include emojis? Currently, I'm failing to load the font and getting the following error: MiniMagick::Error in HomeController#index `mogrify -...
Ball Feke's user avatar
0 votes
0 answers
40 views

Ruby and Microsoft Entra ID

We have a Ruby web apllication which is registrated in Azure Microsoft Entra ID. We registered the application but it doen't work. AADSTS650053: The application 'Application' asked for scope '...
sada's user avatar
  • 683
0 votes
0 answers
29 views

ruby web request integrated auth/sspi

I am trying to write a ruby method that can fetch a url from a web server that requires integrated authentication. This is on Windows and the user already has access. I am looking to do it natively, ...
rismoney's user avatar
  • 531
0 votes
2 answers
57 views

How to read gzip file download from an API

I`m trying to download a file from an API that give me sales of a client. But I dont know how to do it. url = URI("https://conciliation.stone.com.br/v1/merchant/{MYCODE}/conciliation-file/...
Diogo Amaral's user avatar
0 votes
0 answers
39 views

Rails 7 devise gem can't login with valid credentials after some days

Rails 7 Devise 4.9.4 (with bcrypt (~> 3.0)) User can't login error raised "Invalid Email or password." User reset password and can login with new password after some days he/she can't ...
Mr.Muhammad Ramzan's user avatar
0 votes
2 answers
104 views

How to define a class instance variable in Ruby Struct subclass?

How can I define a variable that has shared access by instance methods of a Struct? I can use a global variable $tmp like this: Triple = Struct.new :x, :y, :z do def mul s $tmp.x = x * s $...
igouy's user avatar
  • 2,600
1 vote
1 answer
24 views

Prawn Gem - Print the textbox section dynamically after a table

I use prawn gem to generate a pdf file with tables and other sections. The text_box position are static and it is working as expected. Now I want the text_box below the table to be dynamic. Below is ...
siva's user avatar
  • 1,471
0 votes
4 answers
121 views

In Ruby, how to count the number of instances created (including subclasses)?

The following class Point contains a class instance variable @count that counts the number of instances created. It seems to work fine: class Point @count = 0 class << self ...
user200783's user avatar
  • 14.1k
0 votes
2 answers
50 views

Rails numericality validation does not work when using symbol

I have the following validation in my 'config' model: validates :property_value_max, numericality: { only_integer: true, allow_nil: true } and it works if I try to update it like (in the sense that ...
skamsie's user avatar
  • 2,696
0 votes
1 answer
23 views

How best to propogate an `admin` status to children using Rails and Ancestry

I have User and Collection models, and am using the Ancestry gem to support nested sub-Collections. Each collection has many admin_users and each user is the admin of many collections: # user.rb class ...
Steven Clontz's user avatar
0 votes
0 answers
25 views

Problem with trying to install Kleopatra on mac [closed]

I'm trying to install Kleopatra on mac but of course since nothing works for mac I had to download it from here: [https://github.com/algertc/homebrew-kleopatra4mac] Im guessing I have to run this file ...
Ruben Raidvere's user avatar
-3 votes
0 answers
38 views

Ruby On Rails MVC Pattern [duplicate]

Basically i'm new to ROR. So i just wanted to know about it's MVC Lifecycle. In MVC one thing is bothering me which is that, if controller accept the user request and then perform desired actions(all ...
Nouman Ahmad's user avatar
0 votes
0 answers
66 views

Ruby on rails - I want a behavior, when validity is true, but validity is always true, as Required: false,

My issue is precisely this. I am using simple forms and one of my sections (one_liner), is not behaving as wanted. As it can be seen from the picture, the label should not hover, if nothing is ...
Mahir Ekinci's user avatar
0 votes
2 answers
50 views

How do i upgrade nokogiri compatible to my rails & ruby version

I was trying to start a rails project (version 6.x), for which a nokogiri error was there: ERROR: Error installing rails: The last version of nokogiri (>= 1.8.5) to support your Ruby & ...
Akshat Parashar's user avatar
0 votes
0 answers
18 views

How to add a new attribute to SQS message using Shoryuken before msg moves to DLQ

To add an attribute to SQS msg when an error happens, I have added a custom exception handler. class ShoryukenExceptionHandler extend Shoryuken::Util def self.call(exception, _queue, _sqs_msg) ...
Ankita's user avatar
  • 169
0 votes
1 answer
43 views

Testing file uploads in Rails App using cucumber

I have the following cucumber test in my Rails app with the following step I attach a contract which should basically upload any file to check if upload works (upload is mandatory). Problem: I don't ...
Julian's user avatar
  • 52
0 votes
1 answer
45 views

Using Arel.sql with Arel::Nodes::Case in Ruby for Dynamic subquery

I want to get the timestamp for a table of locations in each rows' local timezone (stored in tz_name column). Generalized, how does one have a dynamic sql call for the timestamp in a given timezone ...
dreadstar's user avatar
0 votes
0 answers
39 views

Cloudflare R2 - Aws::S3::Errors::NoSuchKey (The specified key does not exist.) - Shrine, Ruby

I am having an issue when uploading to Cloudflare R2 object storage. I tried using S3, which works well, but I need to set up R2. For uploading I am using gem Shrine. I created a "demo code" ...
Kubatron P's user avatar
-3 votes
1 answer
74 views

Files with a dot at the beginning are not copied [closed]

I use Thor to copy the contents of one folder to another, here is my code: module Generators module App class New < Thor::Group include Thor::Actions desc "Generate a new ...
synthematikj's user avatar
0 votes
1 answer
29 views

Insert after closing ERB tag with spree/deface

there is a project called TheForeman (v3.3.0) for which I want to override some ERB templates with spree/deface (v1.5.3), for example _managed.html.erb, and add something at the end of it. # in app/...
Xavier Mol's user avatar
1 vote
1 answer
45 views

Rails.logger not working in ApplicationJob.before_perform

I'm using ActiveJob to manage my jobs, and I have the following ApplicationJob: class ApplicationJob < ActiveJob::Base # [...] before_perform do |job| Rails.logger.info 'before_perform ...
Heitor Danilo's user avatar
0 votes
0 answers
47 views

rvm list known doesn't show latest ruby verions

I'm using rvm as the Ruby package manager and was trying to update the ruby version. rvm list known only shows ruby versions till 3.0.0. I'm using Mac Sonoma (Apple Silicon). While trying to run rvm ...
backpropper's user avatar
0 votes
0 answers
19 views

Fluent-bit tomcat localhost access log is parsing as a single line msg [duplicate]

below is tomcat access log incoming msg 127.0.0.1 - - [27/Aug/2024:00:51:49 +0000] "GET /TA HTTP/1.1" 302 - 0 Below is fluent-bit.conf file: [INPUT] Name tail ...
Bhanu Praveen's user avatar
0 votes
0 answers
26 views

fog-aws gem to upload multipart archive to glacier vault - failing

I am using fog-aws gem version 3.25.0 Here is the code that was working previously but now not working with multipart, if I try without multiple part then it works glacier = Fog::AWS::Glacier.new(...
SMNTB's user avatar
  • 819
0 votes
0 answers
18 views

Signing Soap Headers with Savon

I'm using Savon to connect to SOAP with wsse signature. When trying to make call I recieve error that SOAP Header must be signed. header = { "Header1": { "@xmlns:ns2": &...
Gludek's user avatar
  • 13
0 votes
0 answers
40 views

ruby - ovirtsdk4 Error during SSO authentication, access_denied: Cannot authenticate user

Ruby ovirt-engine-sdk is not working after my mac update. It was working before update and it not working after mac update Current mac version: Sonama - Version 14.6.1 I tried installing them gem with ...
Siddu hadapad's user avatar
0 votes
0 answers
26 views

Mailcatcher HTTP/1 is not supported

I am using Mailcatcher when doing testing with codeception in an Github Actions. Installing it like this: - name: Install & run mailcatcher run: | sudo gem install mailcatcher --no-...
maidan's user avatar
  • 209
2 votes
2 answers
64 views

Dynamically change active storage service on rails model?

I'm using active storage with s3 to attach a file to a model called Document. I need to add support for users in the EU that want their document files stored in an s3 bucket in the EU. I have my ...
David's user avatar
  • 415
0 votes
0 answers
54 views

Install ruby 3.3.x with rvm, missing psych gym

I'm installing ruby 3.3.x with rvm by rvm install 3.3.5, no apparent error shown. However, I noticed psych gem folder is empty,even though it's there in the gem list as psych 5.1.2. this causing ...
gkeepa's user avatar
  • 143
0 votes
0 answers
38 views

Converting Raw Rails Select_all result row into multiple Model objects

I am needing to improve performance on a set of code that for a Vehicle and Owners tables, returns the following: [ vehicles (list of vehicle objects), vehicles_to_owner (hashmap of vehicle.id -> ...
mpstack's user avatar
  • 153
0 votes
1 answer
45 views

Override noticed gem delivery method

I'm using noticed Gem version 1.6 with my Rails application. I'm trying to override the delivery method in lib/noticed/delivery_methods/fcm.rb' so when the response returns an error code other than ...
Samar's user avatar
  • 405
1 vote
1 answer
26 views

Can't use wkhtmltopdf-binary due to error "PDF could not be generated!"

Trying to execute tests on project and got errors with wkhtmltopdf-binary: Failed to execute: ["/home/o200/.asdf/installs/ruby/2.7.3/bin/wkhtmltopdf", "--margin-top", "5&...
Alexander Abramov's user avatar
0 votes
2 answers
53 views

Not able to parse tomcat localhost access log via fluentbit reg ex

Not able to parse tomcat localhost access log via fluent bit using reg ex. Below is my incoming log: 127.0.0.1 - - [27/Aug/2024:00:01:48 +0000] "GET /TA HTTP/1.1" 302 - 0 Need output as ...
Bhanu Praveen's user avatar
-1 votes
1 answer
58 views

Rails query output row # 1 and then continue to row # 3

Row # 1 only output 1 record continue the rest on Row 3 - if @local_news.present? %h4.homepage-heading .row#local_news - @local_news.each do |news| .col-sm-12 = render '...
S Mares's user avatar
  • 55
0 votes
1 answer
19 views

Parsing tomcat multiline catalina log with ruby regex in fluent-bit is not working as expected

Below is my multiline log for catalina output: > 21-Aug-2024 04:51:02.916 INFO [http-nio-16500-exec-3] > org.apache.coyote.http11.Http11Processor.service Error parsing HTTP > request header ...
Bhanu Praveen's user avatar
-1 votes
1 answer
41 views

How to start sidekiq/bundler via systemd service on rvm

so I have a systemd service to run my rails application, which works great. [Service] Type=exec User=my-user Group=my-user WorkingDirectory=/home/my-user/my-app ExecStart=/bin/bash -lc "bin/rails ...
faervan's user avatar
  • 31
1 vote
1 answer
82 views

What's the benefit of having a scope-resolution operator within the language?

For example: puts FileManagement::CSV.Reader.new Why not: puts FileManagement.CSV.Reader.new? Why this differentiation? What's the benefit of having the additional ::-operator?
cluster1's user avatar
  • 5,598
0 votes
1 answer
27 views

How to use Jekyll github-pages with Ruby 3

I use Jekyll and Github Pages. However, when I run with Ruby 3, I experience errors when trying to serve the site locally. Specifically: $ bundle exec jekyll serve [...] jekyll 3.10.0 | Error: ...
D.W.'s user avatar
  • 3,571
0 votes
0 answers
63 views

How can I parse JSON to a heterogeonus nested struct in Ruby?

Let's say I have A = Struct.new(:name, :languages, :index) where :sections is supposed to be an array of items of this class: B = Struct.new(:language, :text) So, a JSON like this: { "name"...
toolforger's user avatar

1
2 3 4 5
4586