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

Implementing user impersonation in Rails API + React client

So, I found gems like pretender, user_impersonate2 and switch_user. They all seem to accomplish the similar goal - switching current_user for systems like Devise, for "monolith" Rails apps.I have a...

View Article


Setting path/gem_home in combination with 'bundler/inline', rbenv and a...

In a quest to make ruby scripts that are standalone and portable, I'm using bundler/inline.The servers that I provision this script to, are pretty specific, they have rbenv (so we can rollback/use...

View Article


ruby ARGF's class name weird

Is this a cruby bug?km@latika:~$ ruby -v -e 'puts nil.class.to_s, ARGF.class.to_s'ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]NilClassARGF.classkm@latika:~$ jruby -v -e 'puts...

View Article

How can I integrate Dropzone.js in Ruby on Rails 7.1.2

I'm attempting to integrate dropzone.js in Rail version 7.1.2, but JavaScript does not work. There appears to be a problem with importing node modules in the most recent version of Rails, so I manually...

View Article

How to add validation only to an associated table in active record

I have an address table in rails:class Address < ApplicationRecord validates :street, :city presence: { allow_blank: false }endthe table is associated with several tables and I added validation to...

View Article


How to avoid Bundler Authentication Call in production for a gem only used in...

We currently host a gem (custom version of rubocop) in a private Github repo for one of our rails applications. In order to successfully bundle install that gem, bundler needs to have credentials with...

View Article

Rails 7 and Adminkit when I click the icons disappear

I'm trying to implement Adminkit in Ruby on Rails 7, using feather icons. The problem is that when I click on a link_to tag the icons do not appear again.At the same time this message appears in the...

View Article

How do I dynamically choose fog provider when interacting with the storage?

I have a simple rails model which contains an image. The images are currently stored at AWS S3, but I need to move them to to Backblaze. I have an uploader class which looks like this too:class...

View Article


ruby `pry`: can I edit classes?

In pry, if I type edit fn_name I can open the definition of fn_name in an editor and change it. Say:def fn_name puts 'fn_name'endI can also edit class methods if I type cd ClassName and edit...

View Article


How to pass options via Rake to Yard to Kramdown to use GFM

I've a gem that I've produced with some docs written with Github Flavoured markdown (GFM) to take advantage of their syntax highlighting.Unfortunately, Github decided to use their own syntax for code...

View Article

Get max id of all sequences in PostgreSQL

We have a monitor on our databases to check for ids approaching max-int or max-bigint. We just moved from MySQL, and I'm struggling to get a similar check working on PostgreSQL. I'm hoping someone can...

View Article

Ruby PKCS7: added "\r" bytes are breaking decryption

Using Ruby's OpenSSL lib, when I try to both encrypt and sign a message as a PKCS7, I find that some extra \r characters get inserted, and I can't decrypt the message.Below I have a toy example. I more...

View Article

Undefined local variable or method `make' when installing therubyracer on MacOS

I've been developing on this project for about a year now, but about a month ago I ran into an issue where I had a gem installed that was incompatible with my version of ruby (using rbenv; 2.3.1). I...

View Article


How to find nearest parent by tag_name with selenium

I'm working with "Table styled" web site by using selenium-webdriver. There are a lot of nesting of tables and there are no id or name attributes of them.So I decided to get header text in a table to...

View Article

/usr/bin/env: ‘ruby3.0’: No such file or directory

I try to run this command sudo bundle exec rake ridge:apply ALLOW_DROP_TABLE=1 ALLOW_REMOVE_COLUMN=1but get this following error /usr/bin/env: ‘ruby3.0’: No such file or directoryafter that I use which...

View Article


How to access specific model in rails config/production.rb file?

I want to send exception mail to email_ids stored in yb_notifier_email_ids table. Previously, email_id was hardcoded in production.rb file. I want to send mail by using model. But as configurations...

View Article

Couldn't install mysql2 0.5.3 in M1 MacBook Big Sur

Hi I am trying to install mysql2 gem in MacBook M1 Big Sur, I am getting the the following errors.ld: library not found for -lzstdclang: error: linker command failed with exit code 1 (use -v to see...

View Article


ActionView::Template::Error ( The asset "application.css" is not present in...

After shifting from webpacker to importmaps in Rails 7. I keep getting this error no matter what I do to resolve it. Following is the output of the error.I, [2022-12-02T11:33:16.828698 #2401] INFO -- :...

View Article

Can't filter in a join table

I am creating an API in ruby on rails and I have 3 tables Invoice, Package and Additional_charge.Invoice has many Packages and Packages has many Additional_chargesI have this query:invoices =...

View Article

HashMap grow_buckets method not working as expected in Ruby

However, it seems that the grow_buckets method is not functioning as expected, and I am not getting the desired result when attempting to grow the capacity of the HashMap.I have thoroughly reviewed the...

View Article
Browsing all 4627 articles
Browse latest View live


Latest Images