338,154 questions
-1
votes
0
answers
98
views
Tab trap on modal
I was trying to fix a bug in the framework I use where when I went to 'share' a comment, a modal would pop up with some options, the problem was that I couldn't tab through the modal.
I managed to fix ...
0
votes
0
answers
89
views
wkhtmltopdf breaks multi-column invoice layout when content grows (Rails 5 / Ruby 2.5) [closed]
I am using Rails 5.0.7.2 with Ruby 2.5.1 and generating PDFs from HTML using WickedPDF (wkhtmltopdf).
The invoice layout contains two logical columns:
- left: dynamic invoice items (can grow very ...
3
votes
0
answers
125
views
When eager-loading an association with includes(), is it possible to use named scope to avoid writing long & complex Hash?
Let's say I have this sample model structure:
class Book
has_many :stores
end
class Store
has_many_attached :images do |attachable|
attachable.variant :small, resize_to_limit: [ 64, 64 ]
...
4
votes
1
answer
320
views
Ruby on Rails Redis connection_pool wrong number of arguments (given 1, expected 0)
I recently encountered an issue deploying a Ruby on Rails app to production (on Render) whereby the app would not build and rake tasks would not run. The application would build and launch fine in ...
Best practices
0
votes
2
replies
86
views
What's the best setup to use Ruby on Windows?
I'm new to Ruby and I'd like to know the best way to program in Ruby on a Windows computer.
I already have a setup, but it's not working very well: I have VS Code with the Ruby LSP extension, and in ...
0
votes
0
answers
74
views
How do I install ruby tk for ruby 3.4.7 on Windows?
I installed the latest version of ActiveTCL and ruby 3.4.7. When I try to run gem install tk, I get the error
make failed, exit code 2
Gem files will remain installed in C:/Ruby34-x64/lib/ruby/gems/...
0
votes
0
answers
79
views
How to broadcast a record update in Rails 7
In a Rails 7 app, I'm trying to add chat functionality, but I'm having trouble broadcasting messages.
My (dummy) code looks like
app/models/chat_message.rb
class ChatMessage < ApplicationRecord
...
1
vote
1
answer
76
views
How to avoid checkout payment race conditions with limited stock? Rails 8
I am building an e-commerce with Rails 8 and Stripe through their API for a pottery business. These are all unique, one-off items for now and with the demand she already has, I anticipate her site ...
0
votes
0
answers
96
views
rails 8 error: Uncaught SyntaxError: import declarations may only appear at top level of a module
I have a new Rails 8 application built with Bootstrap, Ruby 3.4.7, MySQL, and Haml, running in Firefox 145.
It all looks good, except for the uncaught exception:
Uncaught SyntaxError: import ...
0
votes
2
answers
78
views
Rails App, Auto loading files during initiliase phase
I have a Rails 8 app that is pretty bare boned.
I'm just setting up my dependency injection container, which registers relevant services here at:
config/initializer/command_bus.rb
The issue is that I'...
-3
votes
0
answers
102
views
Error in PostgreSQL when running Rails and PostgreSQL using Docker Compose
When I run the command on docker container backend:
psql -h localhost -p 5432 -U postgres
I receive the following error:
psql: error: connection to server at "localhost" (::1), port 5432 ...
0
votes
1
answer
53
views
Assertions for travel_to with attribute-based timezone
At 10 a.m. an object becomes active and visible to the user.
seconds_since_midnight.to_i at 10:00 is 36000, but that is not timezone aware.
application_controller sets a tenant and its timezone, based ...
-1
votes
0
answers
61
views
Getting Rails 6 error after upgrading from 5.2 to 6.0.6 [duplicate]
Here is the error:
bundle exec rails app:update:bin
/home/ubuntu/.rvm/gems/ruby-3.1.2/gems/activesupport-6.0.6.1/lib/active_support/logger_thread_safe_level.rb:16:in `module:LoggerThreadSafeLevel': ...
0
votes
2
answers
88
views
Can't connect to MongoDB Atlas (free tier)
I'm struggling to connect from my Rails deployment to an Atlas Cluster.
This is my MONGODB_URI:
mongodb+srv://JohnDoe:****@cluster0.*****.mongodb.net/XYZ_prod?retryWrites=true&w=majority
The ...
0
votes
0
answers
73
views
How to add [page] , [topage] in the body of PDF
I am confused about generating the PDF. I have a case
Table of content
A-1 .......................................................................... 2
B-2 ..............................................