Testing with rspec .consider_all_requests_local = false
I'm using in my application_controller : .consider_all_requests_local like unless Rails.application.config.consider_all_requests_local rescue_from ActionController::InvalidCrossOriginRequest, :with...
View ArticleApp not starting with cryptic Passenger log error
I have a Rails app set up with Passenger + Nginx.When trying to access the app I get the following error in passenger's logs:/home/my_user/.rbenv/versions/3.3.1/bin/ruby: No such file or directory --...
View ArticleHow can I fix Postgres deadlock errors in Minitest?
I am using Minitest and Postgres to test my Rails website. When I added tests for model and controller, I started getting Postgresql deadlock errors in different tests.UPDATEI found the problem. I get...
View ArticleHow to use Faker to generate titles and real English texts
I have a table called posts in my database and each record represents a post with title, url and body.Is it possible to use Faker to generate titles and bodies in English? The body should be actual...
View ArticleMaking JS specs work with headless Chrome
I have a Sinatra app with a Rspec suite and now I need to run it on GitHub Actions. My workflow looks like:name: continuous-integrationon: pull_request: branches: - '*' push: branches: - masterjobs:...
View ArticleChef recipe NoMethodError: undefined method `[]' for nil:NilClass
I am encountering an issue in my Chef recipe, it suddenly stop working and giving me the error that **undefined method '[]' for nil:NilClass**This error is occurring in the following section of my Chef...
View ArticleOriginal variable changes outside the recursive function's scope even though...
I come from a python and C++ background. The original variable is real_array_slice and real_slice.Input array: [2.799999952316284, -0.40000003576278687, -0.40000003576278687, -0.3999999761581421,...
View ArticleHow do I correctly call Magento SOAP API with Ruby Savon for Category Product...
I am trying to call the catalog_product_link.list API method using Savon. However, I keep receiving the error Error cannot find parameter.Here is what I am using, though I have tried several variations...
View ArticleHow to append a text to file succinctly
Instead of writingFile.open("foo.txt", "w"){|f| f.write("foo")}We can write it File.write("foo.txt", "foo")Is there simpler way to write this one?File.open("foo.txt", "a"){|f| f.write("foo")}
View ArticleRuby On Rails - Google Cloud Speech to Text Synchronous issue
I have a ruby on rails web app and I would like to incorporate Google's Cloud Speech to Text API. This is what I have written so far:Stimulus (just portion of the code): connect() { this.audioChunks =...
View ArticleStoreKit2 Auto-renewable subscription with rails backend [closed]
I'm building an iOS app with a Rails backend. I need to link a purchased subscription to a user in my app. What's the best approach to handle this integration and ensure the subscription status is...
View ArticleGetting 'Error cannot find parameter' when creating category with Magento...
BackgroundI'm trying to create a category through the Magento SOAP API using Savon. Before anyone suggests it, I can't use the Magento SOAP v2 or REST APIs.This code sets up my client and logs...
View ArticleHow to access the Magento Core Api using Ruby
I am new to Magento. How do I access the magento core API using Ruby? Are there any tutorials or blogs?Thank you.
View ArticleGlimmer Lib-dsl-libui program throwing error when stripped down to single...
Periodically get error "Encountered an invalid keyword 'val' at this object: main" in a ruby glimmer program. The only way i have found to fix this once starts is to rename the code file.In this case...
View Articlecreate array with iterative assignment
Would like to exploit the following behaviour in Rubyary = Array.new(5) { |i| [i, j=2*i, k=j+1]}p ary #> [[0, 0, 1], [1, 2, 3], [2, 4, 5], [3, 6, 7], [4, 8, 9]]It works for my purposes, but I...
View ArticleHow to implement Enums in Ruby?
What's the best way to implement the enum idiom in Ruby? I'm looking for something which I can use (almost) like the Java/C# enums.
View ArticleHow to convert Unicode styled forms into plain text
I need to convert user input like "ππ π§πͺππππππ" into plain "ASCII" text, i.e. "jovy debbie".The input comes in different styles, e.g. "π±ππππππ«ππππ" or "πΆππππππ’ππ½ππππππ»πππππ".Any Help will be...
View ArticleRuby create JSON from SQL Server
I am trying to create JSON in Ruby from data coming from a SQL Server table, based off a query. I've worked with Ruby quite a bit and JSON some. But never together.This is a sample of the JSON I'm...
View ArticleAn error occurred while installing pg (1.1.4), and Bundler cannot continue....
I tried to intall bundle and this error occurred everytime.i need fix to this error, i have check all solution on stack overflow but nothing worked for me, i'm using ruby 3.0.1, rails 6.1.7 and pg 14An...
View ArticleInstalling nio4r via brew install throws an error on macOS catalina
I understand that this issue has a ton of answers on stack overflow (and other sites) but none of them seem to work for me. Here is where the issue arises. When I tried to run my server, this error...
View Article