Passphrase Key-based authenication with net-sftp in Ruby
Based on question Key based authenication with net-sftp in Ruby, I can SFTP with key-based authentication using the following:Net::SFTP.start(host, "user", keys:['~/.ssh/my_key']) do |sftp|...
View ArticleIs loading structure.sql using rake an atomic transaction?
Is loading structure.sql via rake atomic?If I load structure.sql using this command and it fails because of an error within the structure.sql file:$ bundle exec rake db:schema:load...
View ArticleRails/Rspec - How to use multiple it without redoing work
Multiple times I want to check multiple things over the same action, say that I want to do a PUT and see if the request returned 200 and if the response value contains some values and if the...
View ArticleRuby Serialising and deserialising json
I have this two function to serialise and deserialise game state. I got it working okay. But It feels very cluttered and messy. Is there a better approach of doing this?There is two different class...
View ArticleStimulus Controllers Not Functioning At All In Rails 7 App
I'm really struggling to get Stimulus controllers to function in a Rails 7 app I'm working on and would appreciate any help anyone might have. I've been spinning my wheels forever.My Application.js//...
View ArticleMy Ruby Code is not allowing me to read and give inputs [closed]
enter image description hereI was learning ruby and how "gets" method helps us take the user input. While I was trying it on Sublime Text and VSCode my simple code does not read the input and also does...
View ArticlePalo Alto API: how to iterate to get logs page by page?
I have a ruby program that retrieves logs from Panorama using the API.You start with: response = pa.api_request( :post, 'api/', {'type' => 'log', "log-type" => "threat" ,"query" => "..."...
View Articlewhy can't Bundle exec can't find installed gems in 'vendor/bundle'
I'm trying to execute a rails project (via bundle exec puma -C config/puma.rb) and I'm getting "Can't find GEM NAME" errors.What's strange is that this is only a recent issue after a DB upgrade caused...
View ArticleRuby: How to check if a string is a valid time?
I'm pulling data from a feed that I have no control over and I need to verify if a string I'm given is a valid time.Most of the time I'm correctly sent something like "2:35" or "15:41" but other times...
View ArticleCan not deploy Ruby on Rails app which was deployable till Dec 2023
I have a Ruby application that has been used for years and since December 2023 I can no longer deploy it. I use capistrano for deploy. Ruby should be version 2.6.1. When deploying, it gives me an...
View ArticleS3 Ruby SDK List Only Objects Directly under a prefix?
I'm trying to get a single level of objects under a prefix in an S3 bucket. There are a LARGE number of objects in the bucket so I want to iterate over each folder under a specific prefix. Here's my...
View ArticleRuby Web Scrape (Nokogiri) - cleanup
I'm experimenting on how to scrape a website for data. This is what I've put together after a few days of research, however, the output from Nokogiri is not as "clean" as I would expect. When I print...
View ArticleOrder results from SQLite table according to number of occurences of the id...
So, the SQL code I made to complete this query is as below:SELECT stories.*, COUNT(*) AS vFROM stories, viewsWHERE stories.story_id = views.story_idGROUP BY stories.story_idORDER BY v DESC;How would I...
View ArticleMac os: Rails broken - bundle not working - ovirt-engine-sdk - ERROR: Failed...
I'm trying to use ovirt-engine-sdk gem in my rails(6) application. bundle install is failing in my mac machine.As per the PR's the gem should work with ruby 3.x versions but i'm getting following error...
View ArticleType signature for a method that can take a hash or keyword arguments in RBS
I'm trying to add type check support in RBS for the following method: def create_bridge(caps:, url:, http_client: nil) Remote::Bridge.new(http_client: http_client, url: url).tap do |bridge|...
View ArticleUninitialized constant error with Sidekiq and Rails
I've been getting a whole bunch of uninitialized constant errors lately and I can't figure out why. Below is a specific example. In this example, I am calling a job from within a job. But I am getting...
View ArticleReact-Native init - Cocoapods was resolved
if i run "npx react-native init testApp" i get the following error. What should i do to resolve this error?An error occurred while installing nkf (0.2.0), and Bundler cannot continue.In Gemfile:...
View Articlerbenv - Ruby - How to switch ruby versions between multiple projects
I installed Ruby using rbenv. I am using Mac. For one of my project I am using ruby 2.6.3. For my other project I need ruby 2.7.4. So I installed both the versions.In my first project, if I do rbenv...
View Articleunable to install pg gem
I tried using gem install pg but it doesn't seem to work.gem install pg gives this errorTemporarily enhancing PATH to include DevKit...Building native extensions. This could take a while...ERROR: Error...
View ArticleInput Output from CSV in Ruby. console output different from file output
I am learning the csv application in ruby.I have a function which takes a string and looks up words against it based on starting alphabetNow i am trying to read a file which has lots of strings and the...
View Article