Category "ruby"

How can I avoid "Zip end of central directory signature not found (Zip::Error)" with rubyzip?

I'm reading a lot of zip file with rubyzip. However this error message is always showing in only specific file even it is zip file. /app/vendor/bundle/ruby

Is it OK to specify a schema in `table_name_prefix`?

TL;DR: Is it OK to specify a schema in table_name_prefix? We have a large Rails application that is not quite a traditional multi-tenant app. We have a hundred

How to print unicode character U-1F4A9 'pile of poo' emoji

I am trying to print a unicode character in Ruby, specifically the pile of poo. It has a unicode value of U-1F4A9. But when I try to print "\u1F4A9" to the outp

Ruby constants in singleton methods

I have a Ruby C extension; I call that class FooC defined in ext/foo/foo.c, in that file I have void Init_foo(void) { VALUE cFoo = rb_const_get(rb_cObject, rb

Heroku error: "key must be 16 bytes" but the key I have inputted is 16 bytes

I am launching to Heroku for the first time and I am getting the error "ArgumentError: key must be 16 bytes". I have run rails credentials:edit to generate a

How do I get the size of a ruby object in mb in Rails?

I want to query an ActiveRecord model, modify it, and calculate the size of the new object in mb. How do I do this?

ruby: calling super without having a parent class

I have a class which overrides self.new and calls super in it, but the class doesn't derive from antoher class. So what exactly does the call? class Test att

How to use stimulus components with rails import maps

I want to include this stimulus component into my brand new rails 7 app: https://www.stimulus-components.com/docs/stimulus-dropdown When I follow their setup ap

Opening ruby app from Rubymine terminal

I just got Rubymine and getting used to ruby on rails on mac , Im wondering if there is any command to open a ruby app on Rubymine 7 , from terminal would th

Divider in divs with Tailwind

I have this now <div class="w-2/3"> <h2 class="text-2xl font-semibold">Ordered Items</h2> <table class="w-full border-collapse"> .....

Could not find public_suffix-2.0.4 in any of the sources

It started when I tried to add the Google Tag Manager Gem to my local installation of Jekyll. A little background here, I'm using homebrew and rbenv. My r

Change the default value for table column with migration

I try to change the default column value from false to true. But when I run rake db:migrate VERSION=904984092840298 I got the following ERROR. StandardError: A

Why won't Rails.cache store API responses?

I am trying to cache the results of API calls. My application makes multiple calls with the same result and I would like it to use the cache to save time. When

The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256

I get an error AWS::S3::Errors::InvalidRequest The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. when I try upload fi

Use Ruby's heredoc syntax to read a regular expression

In my tests, I have a - somewhat longer, multi-line - HTML response containing a date and time. I thought I could use assert_match to compare the expected resul

How can i create JSON array of JSON objects in ruby from a loop

I am trying to loop through some video objects and i am trying to build a JSON array that looks like this: [{"event_name":"video_completed","object_id":1234567

How to zip every element of array to every element of another array in ruby?

Say I have this array: [0, 1, 4], [2, 3] How can I merge them to get: [0,2], [0,3], [1,2], [1,3], [4,2], [4,3] I tried: [0, 1, 4].zip [2, 3] But I got:

How i can receive variable from another thread in Jmeter

in the first thread, I received JSON (format - {"id":6054,"name":"Jmeter created chat","description":"jmeter created test"}) I want to use it in the second thre

Rspec 3 how to test flash messages

I want to test controller's action and flash messages presence with rspec. action: def create user = Users::User.find_by_email(params[:email]) if user

Regex matching plus or minus

Could someone please look at the following function and explain the regex for me as I don't understand it and I don't like using something I don't understand as