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

Ruby: Limiting a UTF-8 string by byte-length

This RabbitMQ page states:Queue names may be up to 255 bytes of UTF-8 characters.In ruby (1.9.3), how would I truncate a UTF-8 string by byte-count without breaking in the middle of a character? The...

View Article


active admin gem error message just following the instructions

I am using ruby 3.1.3, rails 7.0.5 and activeadmin 3.0.I just followed the installation instructions from the activeadmin website, but I got the following error:ActionView::Template::Error (Ransack...

View Article


wrong number of arguments (given 1, expected 0; required keywords: io,...

I'm having a problem with active storage after upgrading rails version to 7.1.2. I am trying to run this code:banner = Banner.newimg_url =...

View Article

Google Analytics V1 Client - Unable to change credentials type

We are trying to use the google-analytics-data-v1beta Ruby client library to interact with Google Analytics V1 APIs.However, we require permission from our web app's users so we added a consent screen...

View Article

Accumulator pattern for ruby_block or other non-template resource

I want to create a chef accumulator custom resource that accumulates data from multiple instances, and then uses a ruby_block resource to modify an existing file.All the examples of accumulators that I...

View Article


How to avoid deleting backslash in Node.js

I have to verify signature that created by Ruby service. The signature is creating from stringified JSON data.The problem is that if data contains single backslash in nested strings then Node.js...

View Article

I'm having this error in my app ruby on rails

StandardErrorDirectly inheriting from ActiveRecord::Migration is not supported. Please specify the Active Record release the migration was written for:class AddAttachmentImageToPosts <...

View Article

Ruby. Bundle is locked to json-canonicalization

I'm trying to upgrade a Mastodon instance (from v4.0.2). I have no knowledge of ruby and I follow the instructions blindly. I have managed to update ruby to the latest version, but when I run bundle...

View Article


GCP - Cannot auth with google platform in ruby with service account attached...

We have Instance 1 from Project A trying to reach Cloud Function v1 API from Project B, using a service account (lives on Project A) assigned to the instance, via ruby code.Instance 1 has the service...

View Article


ruby's operator and sort method

player1 = Player.new("moe")player2 = Player.new("larry",60)player3 = Player.new("curly", 125)@players = [player1, player2, player3]Above, I created some player objects and added them to the previously...

View Article

How do I make my Homebrew installation of Ruby the default over the macOS...

After installing Homebrew and updating ruby to the latest versionbrew upgrade rubywhen I runwhich rubyit still defaults to the pre-installed OSX version at /usr/bin/rubyHow do I change the default to...

View Article

Rails 7 - Using daisyUI with importmap-rails

I'm trying to build a new Rails 7 project, testing out Hotwire and some of the new default stuff. I'm excited by the idea of leaving Webpacker (and maybe React) behind. But I'm having trouble figuring...

View Article

ChunkLoadError: cannot load js asset in jekyll site on AWS S3/CloudFront

TL;DR The browser is able to download a js asset, but the main js is not able to "load" it.NOTE: I have no experience with javascript or web development.The problemI'm using the Hydejack Jekyll theme...

View Article


What yield field do? How the magics works?

<!DOCTYPE html><% provide(:title, "Home") %><html><head><title><%= full_title(yield(:title)) %></title><meta name="viewport"...

View Article

Ruby on Rails ActiveRecord and the primary key

When using Ruby on Rails ActiveRecord to upload and store the name of a file in the partition table database, and the primary key is obtained:After uploading the A file and storing its name in the...

View Article


Minitest::Assertion: "User.count" didn't change by 1, but by 0

test "should create user" do assert_difference("User.count", +1) do post users_url, params: { user: { email: @user.email, name: @user.name } } end end test "should create another user" do...

View Article

Problem installing Cocoapods on older iMac running macOS 12.7.3

I'm a bit of a newbie, so please bear with me. :| ***************I'm trying to add a pod to a Swift app I'm building in Xcode.When I tried to install Cocoapods it threw a bunch of errors (see below)....

View Article


Shopify Inventory Text

I am trying to get our website to display the text "Low stock. Order yours now" if the inventory of the product in question is less than 3.I currently have the following code on the...

View Article

How to set port for Rack app?

builder.rb:def app Rack::Builder.new do run App.new end.to_appendHow to run on a given port?

View Article

How to display numeric value 0.0 as 0.00 as the query result

The value saved in the database is 0.0 as numeric data type.How to display the numeric value 0.0 as 0.00 as the query result?

View Article
Browsing all 4627 articles
Browse latest View live


Latest Images

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