Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Browsing all 4642 articles
Browse latest View live

How do I calculate sentence perplexity using torch-rb?

I have translated this example of how to calculate perplexity to Ruby. I am now trying to adapt it to calculate the perplexity of a given sentence.However, Torch::NN::Functional.binary_cross_entropy...

View Article


Grab all files in dir with specific extension regardless of extension case...

In Ruby what is the right way to get all the files in the directory with a certain extension regardless of the extension case? For example, say I have the directory ~/myDir and it has files file1.JPG,...

View Article


Error when trying to install app with mysql2 gem

Im trying to install an open source rails 3.2.21 application that uses the mysql2 gem, but when i try and run the bundle commant I get the following error:Fetching: mysql2-0.3.18.gem (100%)Building...

View Article

While trying to install Ruby version 2.6.6 on RVM iim getting this Error...

I have already installed ruby version 3.0.0 on my mac os and using rvm and i used the command rvm install 3.0.0 to install the version. and now i want to install the ruby version 2.6.6 and when i use...

View Article

Why Can't I update my contentful entry with ruby gem

I'm currently trying to update entries in contentful using ruby's gem (contentful-management).But it doesn't work.There are no errors and I can't pinpoint the cause.Below is the code and error.Help...

View Article


How to test a script that pushes gems?

I have this script:#!/usr/bin/env ruby# frozen_string_literal: trueif ARGV.any? puts "USAGE: release" exitenddef system!(command) puts command system(command, exception:...

View Article

trouble installing ruby gem json on my mac

I get this warning when trying to install the json module via ruby gems.Any ideas?Mac-Mini poulh$ sudo gem install jsonPassword:WARNING: File...

View Article

Cannot install json gem on Mac

I'm not able to install json gem on my M1 MacBook. This is the command I'm running.sudo gem install json -v '2.6.2'This is the error I'm getting. I'm guessing it because it's picking up Xcode 14.1 Beta...

View Article


Integrating Opensearch with Ruby on Rails

Currently, my Rails application utilizes Elasticsearch with the elasticsearch-model and elasticsearch-rails gems for integration:require 'elasticsearch/model'class Article < ActiveRecord::Base...

View Article


Performance-wise for large models, is it better to have many "to-many"...

I am currently structuring an application where a model will have many large has_many associations. I can demonstrate it in an example below:class Car < ApplicationRecord belongs_to :manufacturer...

View Article

Rails 6 Remove specific error - delete(:email)

I know I can use user.errors.delete(: email) to delete the email validation error, but if an email has multiple errors on it, I assume it would remove all the errors associated with email.Do rails have...

View Article

Stop Rails IRB and debugger sharing history

Since I moved to Rails 7.1 and Ruby 3, I am struggling to use the Rails console history.Previously, the console kept its own history, and the debugger history was separate. So if I was debugging a...

View Article

How can I create sidekiq queues with variable names at runtime?

I am trying to create queues with variable queue names.queue_name = "guide_"+ guide['id'].to_sSidekiq::Client.push({'class' => GuidePdfWorker,'queue' => queue_name,'args' => [key],'backtrace'...

View Article


Installing dependencies from a gemspec file

I wish to work on an existing gem, which I've checked out from a git repository. I'm using a clean Ruby installation. To start, I would like to install the dependencies specified in the gemspec file so...

View Article

Webpacker compile very slow with Docker

We have a rails 6 application that we just dockerized a few days ago (for development environment for now). We had some issues with the image we managed to fix and now the whole application runs...

View Article


How can I warn about Ruby 3 deprecated code, while using Ruby 2.7 with Rubocop?

I'm working on a huge repo with many contributors, and many code changes happen daily. I'm tasked to update current Ruby 2.7.4 to Ruby 3+, and as a first step I have decided best to add some rules to...

View Article

Ruby Array: opposite of `&` for an array

In ruby you can intersect two arrays using the & operator.I'm trying to obtain the remainder of the intersection.If I use a simple case - is sufficient: array_1 = [0, 1]array_2 = [0]array_1 -...

View Article


Ruby - how to check for specific exception after rescue?

In Ruby, I want to do something special for a specific exception but not enough to have a specific rescue. What is the proper syntax to check for a specific exception within rescue?Sample (non-working)...

View Article

Fibonacci sequence in Ruby (recursion)

I'm trying to implement the following function, but it keeps giving me the stack level too deep (SystemStackError) error.Any ideas what the problem might be ?def fibonacci( n ) [ n ] if ( 0..1...

View Article

Rapid MVC desktop application framework in ruby

Currently I am looking for a ruby desktop application framework. I have tried bowline. but it seems that dependencies are outdated and I couldn't get it work... So is there any other framework...

View Article
Browsing all 4642 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>