Category "ruby"

Asdf wont switch local version based on tool-versions or using the local command

I downloaded asdf the other day and am trying to use it with a ruby on rails project I downloaded from Github. When I run asdf install, I get this response: fir

Twilio with Capybara Getting "stack level too deep (SystemStackError)" error

I am getting stack level too deep (SystemStackError) error when trying to make Read: List messages matching filter criteria API call for Twilio in Selenium/Cucu

VSCode - Rubocop - Settings.json - End of file expected

I am using VisualStudioCode with Ruby and Rubocop. After installation of Rubocop i found out i must change some of the settings in settings.json for Rubocop. Ho

Fail to compile webpack when I run ruby server

I have try to run my ruby server and I got this error : [Webpacker] Compiling... [Webpacker] Compilation failed: /var/lib/gems/2.7.0/gems/webpacker-5.2.1/lib/we

what is the functionality of "&: " operator in ruby? [duplicate]

Possible Duplicate:What does map(&:name) mean in Ruby? I came across a code snippet which had the following a.each_slice(2).map(

Dynamic constant assignment

class MyClass def mymethod MYCONSTANT = "blah" end end gives me the error: SyntaxError: dynamic constant assignment error Why is this considered

Find records with missing associated records in Rails

I have a legacy database where I have two models as: class Purchase belongs_to :product end class Product has_many :purchases end Now over time some of

How to handle memoization with nil values with Sorbet?

I have this method: def current_organization return @current_organization if defined?(@current_organization) subdomain = request.subdomain.to_s r

Amazon SP-API String to sign is returning different signed strings

This is interesting. For some reason my request to the Amazon SP-API is perfect EXCEPT for this last bit. @string_to_sign= "AWS4-HMAC-SHA256\n" + "20220512

Ruby on Rails // Getting a Strange Return on .each loop

I am making a shopping cart for a web app. So far it has 3 components: 'products', 'line_items' and 'carts'. The flow seems to be okay. I am getting all the

Rails has_many through has_and_belongs_to_many

I am trying to find way to get data from a has_and_belongs_to_many association through a secondary model. I'll say sorry now as I might not explain this right,

Microsoft OAuth parsing state parameter as string, but return a hash

I'm using the Microsoft identity platform and OAuth 2.0 authorization code flow to authorize user information from Microsoft Azure. In my Ruby code I parse the

Mysql2 connection in ruby always take my Ip address to connect and ignores the value in host

I am trying to connect to my database through mysql2 in ruby with the following: client = Mysql2::Client.new(:host => host, :username => username, :passw

Difference between bin and exe when creating a gem

I'm creating a gem for the first time and I'm a bit confused by the bin/ and exe/ directories. I've added an executable to spec.executables with: spec.bindir

Devise forgot password renders wrong template

Rails 6, Devise 4.7.3 I have a forgotten password template in my views as users/passwords/new.html.erb that renders fine, collects an email, and sends that ba

How do a rename a file using the Google Drive API for Ruby?

This seems like a basic question, but I'm well into my second day now :( I'm using the Google Drive Ruby Api here: https://github.com/google/google-api-ruby-cl

Git Bash on Windows with Ruby: Waiting for gets() input before printing prompt?

I'm new to programming/Ruby and can't figure out this quirky issue... Running this Ruby code through Git Bash on Windows: $ ruby test.rb puts "Give me input:

Unable to run Puma as daemon OptionParser::AmbiguousOption: ambiguous option: -d

I upgraded to Puma 5.0.2 and started my rails app as usual with: bundle exec puma -d -e production -b unix:///home/user/app/tmp/puma.sock Now I get the error:

Rails ActiveRecord migration to add foreign key with 'NOT VALID' parameter

Can add_foreign_key add a 'NOT VALID' parameter to the ALTER TABLE command? (Postgres, if it mattters) I have a foreign key between two very large tables. I ne

Your bundle is locked to ffi (1.11.0), but that version could not be found in any of the sources listed in your Gemfile

I get this error when starting the rails server: I've tried gem install, gem update, bundle update, bundle install. Your bundle is locked to ffi (1.11.0), but