Category "ruby"

Ruby: Libusb, one USB Device, two input endpoints = difficulties

I'd like to read out an USB Device in Ruby with libusb, which has two endpoints for input, once 0x81, which is in fact a Midi input Connector, and 0x82, which i

Write a program that adds together all the integers from `1` to `250` (inclusive) and `puts`es the total

How would I do this using ruby and only using a while loop with if, elsif and else only?

Ruby on Rails routes - Query parameter vs id

I'm trying to set a route that accepts a dynamic field. Restaurants have categories [:chinese, :fast_food, :french, :vegan] and the route restaurants/vegan allo

Flash is not displayed in the same view in Rails

I need to display flash in the same view (:edit) after successfully updating an object. If I redirect to another action - everything works correctly. But when I

Detect if block is given in Ruby define_method block

When searching, keywords 'block' and ruby 'define_method' keep telling me to explicitly define + call the block. Tried a bunch of stuff, including looking at so

How can I write this in haml? (rails app)

<a href="/"> <i class="material-icons">file_download</i> Export to CSV </a> I am using a material_icon gem. "file_download" is a do

Modify updated_at attribute through db trigger in rails

I was wondering if there is anything wrong about updating the updated_at attribute of a record through a db trigger in terms of fragment caching (i.e. the parti

How to ensure I can't add in integers or any numbers into an array via user input for ruby

I'm trying to create an array that only allows strings to be passed through, no numbers at all. Is there a way to make this possible? I've tried the below expec

Use current_user in hotwire partial

Hi I started using hotwire in rails app (currently I am working on adding comments) and I found that partials used for turbo streaming are free of global refere

Generate deterministic Namespace based md5 UUID from a string in java and ruby

I am trying to create a deterministic UUID in java to generate same UUID as we have in our ruby codebase but unable to do so and need help. #ruby code using uui

Ruby (or FFI?) error when executing Jekyll commands

I want to create a new Webpage using Jekyll, but when I execute jekyll new <page>, Ruby crashes with a really long Crash Report that starts like this: /Li

Ruby On Rails sort the array of hash based on priority

Please help me finding the solution sort by based on priority Im not getting the solution priority based on: 1st pick earliest slot 2nd max rating 3rd cronofy_e

Is there a way to seed a key with a value of an array of strings?

I'm trying to seed some data using an external trivia API. Here's what I have in my seeds.rb file where HTTParty is a gem that parses JSON into a ruby hash: res

Issue with Rails

I ran the command rail new friends After a couple of minutes I get the following error Installing bootsnap 1.11.1 with native extensions Bundle complete! 15 Gem

Sidekiq - SearchService::Errors::DefaultSearchException

While running Sidekiq I am getting this error: #<SearchService::Errors::DefaultSearchException: SearchService::Errors::DefaultSearchException> This is o

Ruby on Rails - javascript(s) folder and application.js missing

I'm new to Rails and trying to use some Javascript, but everywhere I go I see application.js mentioned, but it's nowhere to be found in my directories. I follow

Capybara::ElementNotFound: Unable to find checkbox that is not disabled

I've checked all the SO questions I can find related to this issue. The rest of the form works and the test passes if I remove the validation that a PlanTemplat

Can´t install tiny_tds in Windows 10

When I run: gem install tiny_tds The output tells me that I need FreeTDS installed. Next, it shows me some configuration options and that I'll probably need an

gem install puma -v '4.3.7' fails on Mac OS Big Sur Ruby 2.6.3 Bundler version 2.2.19

symptom: gem install puma -v '4.3.7' crashes • Mac OS Big Sur 11.4 • Ruby 2.6.3 • Bundler version 2.2.19 • Homebrew 3.1.9 jason@ % gem

app.css error when compiled with ruby sass from app.scss

I'm trying to build my project with gulp, and the app.scss file is compiled with ruby sass. The problem is the app.css gets error and cannot be applied to brows