338,308
questions
0
votes
0
answers
10
views
Turbo Rails - TypeError: ya is not a function at ga
After updating my Ruby on Rails app, I encountered the following error when hovering over links, and Turbo is not working properly (it reloads the entire page instead of updating the body content):
...
0
votes
0
answers
12
views
How can you automate security audits of javascript packages when using Rails importmap?
When using a package manager like npm you have the ability to run npm audit on your package.json file to check for any known vulnerabilities. You can then add this check to your CI Pipeline to ...
1
vote
1
answer
15
views
Can I switch to Amazon S3 later in Rails 7 after using local storage?
If I'm using the server's local storage for storing images, can I access those local images later when I switch to Amazon S3 plan?
0
votes
1
answer
18
views
Setting up SSL for localhost (MacOS / rails / react / vite)
I'm trying to configure an app on my local development environment to use SSL. I started down this path when I noticed a CORS error upon trying to request data from the back end Rails API. When I ...
-4
votes
0
answers
28
views
How can I centralize tenant data like university and location in a multitenancy Rails app? [closed]
I'm using Ruby on Rails with multitenancy and need to centralize data like universities, majors, and locations to avoid manually adding it for each new tenant. I'm considering these options:
Store it ...
0
votes
0
answers
14
views
Where in javascript:install:[bundler] are the tools installed to terminal?
Question regarding jsbundling-rails gem, asked on github and posting here also for more visibility.
I've tried intalling a couple different bundlers now for a new app, essentially getting the same ...
0
votes
1
answer
21
views
Rails Excel Export has wrong formatting of numbers
My Rails app offers the ability to export payments and invoices in Excel format using the caxlsx and calsx_rails gem.
The export itself works fine. The invoice values though are properly formatted in ...
0
votes
0
answers
34
views
Back button not working as expected after increasing window.history.length on form submission
I am working on a Rails application and have a form that, upon submission, it to increase the window.history.length. I want the "Back" button to take the user back through all the history ...
0
votes
0
answers
28
views
What is the next step to troubleshoot Rails app not responding (Nginx and Passenger seem to be working)?
My Rails app is now deployed (using Capistrano) but doesn't seem to be receiving requests. If I try to connect from Safari it eventually times out, if I try to connect from Chromium I get "The ...
0
votes
0
answers
23
views
Selenium: Unknown error when connected by RDP
I'm running a Debian VM through Windows Hyper-V, and I connect to the system using Remote Desktop from the Windows device. This has been working amazingly for everything, except running Cucumber tests ...
0
votes
0
answers
13
views
activeadmin_addons assets are not align to the activeadmin theme
Issue in activeadmin_addons tags input, slim select.
I am trying to align the form with adding the css inside the below path app/assets/stylesheets/active_admin.scss
no table to overide
tried to add ...
0
votes
1
answer
32
views
Where are those schema.rb discrepancies coming from?
My whole team is using docker so we have similar versions, some people are on Linux and some on Mac. When I call rails db:schema:dump I see few discrepancies in the resulting diff:
The 1st kind is ...
0
votes
1
answer
66
views
Ruby gsub capturing groups
This is my input (stored in content variable):
<p>some text</p>
[image=content_001]Some alt/legend text[/image]
<div>some div</div>
This is my desired output:
<p>some ...
0
votes
0
answers
34
views
Association with Composite Primary keys in rails
I was reading the Association with Composite primary keys part on rails docs
I have 3 questions
1- Why are the names of the foreign keys different in the 2 tables shouldn't they be the same for e.g
...
0
votes
0
answers
18
views
CSP Configuration in Rails with Chartkick
Unable to Set Content Security Policy for Specific Controller Action in Rails with Chartkick
Problem Description
I'm trying to configure Content Security Policy (CSP) in my Rails application, which ...
0
votes
1
answer
33
views
RSpec error with expecting DateTime value to be_within a duration of a ActiveSupport::TimeWithZone value
Why does the following test give me a TypeError: expected numeric error:
it { expect(DateTime.now).to be_within(1.second).of Time.zone.now }
but this test does not?
it { expect(DateTime.now).to ...
0
votes
0
answers
29
views
Can't Render Emojis Using MiniMagick in Ruby on Rails
Could you please help me with generating images that include emojis?
Currently, I'm failing to load the font and getting the following error:
MiniMagick::Error in HomeController#index
`mogrify -...
0
votes
0
answers
33
views
Rails 7 Deployment to Production locally. Missing stimulus controllers [closed]
Everything is working while in development environment and then I tried deploying this in prod env locally to test things out and got an error.
Error log
Use Ctrl-C to stop
I, \[2024-09-12T15:21:22....
0
votes
1
answer
37
views
Tailwind not running in my Rails App. How can I see the issue so I can debug it
I switch my app from webpacker to esbuild. My biggest issue is I don't know how to debug the problem.
When I run bin/dev it exits when it running js: yarn build --watchcss: bin/rails tailwindcss:watch
...
0
votes
0
answers
38
views
Arel query generation for array containment check in Athena/Presto
I'm working on enhancing a report configuration system to support filtering by an array column partition_ids. We want to check if any of the specified partition IDs are present in this array.
...
1
vote
1
answer
30
views
Error on libvips library when installing Ruby on Rails 7.0 app in RHEL8
Trying to install a Ruby on Rails app that uses Rails 7+. Get this error:
Could not open library 'vips.so.42': vips.so.42: cannot open shared object file: No such file or directory.
Could not open ...
0
votes
1
answer
32
views
Retrive actual file name from Rails ActiveStorage S3 file name
I have to migrate assets(images) from Rails ActiveStorage uploaded file to S3 into my another WordPress website.
However, it seems the filename is they Blob key similar to as below:
...
-1
votes
1
answer
32
views
How to debug Ruby on Rails in Heroku Staging with VSCode
We've set up a Heroku Ruby on Rails API app and used the Pipeline feature to create a Production and Staging copy of the app. We develop on a Linux VM with VSCode Remote from Windows PCs and push ...
0
votes
2
answers
57
views
How to read gzip file download from an API
I`m trying to download a file from an API that give me sales of a client. But I dont know how to do it.
url = URI("https://conciliation.stone.com.br/v1/merchant/{MYCODE}/conciliation-file/...
0
votes
0
answers
39
views
Rails 7 devise gem can't login with valid credentials after some days
Rails 7
Devise 4.9.4 (with bcrypt (~> 3.0))
User can't login error raised "Invalid Email or password."
User reset password and can login with new password after some days he/she can't ...
1
vote
1
answer
24
views
Prawn Gem - Print the textbox section dynamically after a table
I use prawn gem to generate a pdf file with tables and other sections. The text_box position are static and it is working as expected. Now I want the text_box below the table to be dynamic. Below is ...
0
votes
1
answer
50
views
Duration between two dates in Ruby (Rails)
If I have a specific date and then add a duration to it resulting in another date
For example:
d1 = Date.parse('1996-02-17')
d2 = d1 + 67.years + 3.months # 2063-05-17
Then, how can I get the ...
0
votes
0
answers
19
views
Rails update xlsm excel file using win32ole not working
I want to update some rows in an Excel file using a Rails form. I saved the data into my Excel file, but all the automatic calculations don't work.
I previously tried this with rubyXL, but the file ...
0
votes
0
answers
25
views
undefined method `slice' for nil:NilClass excluded from capture: Not configured to send/capture in environment 'development'
I get this error when I try to update applications in the admin panel
my controller
frozen_string_literal: true
class Admin::OrdersController < Admin::ApplicationController
def index
...
0
votes
2
answers
50
views
Rails numericality validation does not work when using symbol
I have the following validation in my 'config' model:
validates :property_value_max, numericality: { only_integer: true, allow_nil: true }
and it works if I try to update it like (in the sense that ...
0
votes
1
answer
23
views
How best to propogate an `admin` status to children using Rails and Ancestry
I have User and Collection models, and am using the Ancestry gem to support nested sub-Collections.
Each collection has many admin_users and each user is the admin of many collections:
# user.rb
class ...
0
votes
1
answer
33
views
Rails minitest + authlogic cannot authenticate
I am following the authlogic setup for authenticating an admin user during testing setup using minitest ( https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/test_case.rb ). It seems ...
0
votes
0
answers
31
views
Solid Queue 0.8.2 with sql schema format
From my understanding, solid cache 0.8.2 replaces migrations with a schema to be loaded (available at /db/queue_schema.rb after running bin/rails solid_queue:install).
In my Rails app, I use the sql ...
-3
votes
0
answers
38
views
Ruby On Rails MVC Pattern [duplicate]
Basically i'm new to ROR. So i just wanted to know about it's MVC Lifecycle.
In MVC one thing is bothering me which is that, if controller accept the user request and then perform desired actions(all ...
0
votes
0
answers
24
views
Skip/Add acts_as_list conditionally
I am using a single model for acts_as_list, not sure if it is mandatory to add an associated model.
class TestModel < ApplicationRecord
# need to skip adding a value to position for a specific ...
0
votes
0
answers
66
views
Ruby on rails - I want a behavior, when validity is true, but validity is always true, as Required: false,
My issue is precisely this. I am using simple forms and one of my sections (one_liner), is not behaving as wanted. As it can be seen from the picture, the label should not hover, if nothing is ...
0
votes
2
answers
50
views
How do i upgrade nokogiri compatible to my rails & ruby version
I was trying to start a rails project (version 6.x), for which a nokogiri error was there:
ERROR: Error installing rails:
The last version of nokogiri (>= 1.8.5) to support your Ruby & ...
0
votes
1
answer
43
views
Testing file uploads in Rails App using cucumber
I have the following cucumber test in my Rails app with the following step I attach a contract which should basically upload any file to check if upload works (upload is mandatory). Problem: I don't ...
0
votes
1
answer
45
views
Using Arel.sql with Arel::Nodes::Case in Ruby for Dynamic subquery
I want to get the timestamp for a table of locations in each rows' local timezone (stored in tz_name column).
Generalized, how does one have a dynamic sql call for the timestamp in a given timezone ...
0
votes
0
answers
18
views
redis-rails and acl getting NOPERM with turbo broadcast
We are trying to set passwords on our redis.
redis.conf:
user default on >xxxxxxxx ~* +@all
user user01 on >xxxxxxxx ~* +@all
In our environment variables we have:
REDIS_URL=redis://user01:...
0
votes
2
answers
84
views
`belongs_to` and `before_create` order in Rails
Given a scenario where a book belongs to an author:
class Book < ApplicationRecord
belongs_to :author
end
Now let's add a before_create :ensure_something to the book model. The ensure_something ...
0
votes
0
answers
32
views
How to run RSpec system specs with Dev Containers
I'm trying to set up DevContainers with a Rails 7.2 app, but I'm having difficulties getting my RSpec system specs to run correctly.
My compose.yaml file includes the selenium/standalone-chromium ...
0
votes
1
answer
38
views
Rail Upgrade to 7.1.4, NoMethodError for jsonb field in Postgres Db
Upgrading a project from Rails 5.2, made it to 7.1.4 and it's producing an odd issue serializing jsonb. Given the lack of information I've found, this appears to be an unusual issue.
The error ...
0
votes
1
answer
29
views
Finde css selector with Capybara on a Tailwind pseudo class name
Let say I have a radio button styled with Tailwind class
<input type="radio" class="bg-red-500" checked="checked"/>
I can find the element with Capybara's matchers
...
0
votes
0
answers
39
views
Cloudflare R2 - Aws::S3::Errors::NoSuchKey (The specified key does not exist.) - Shrine, Ruby
I am having an issue when uploading to Cloudflare R2 object storage. I tried using S3, which works well, but I need to set up R2. For uploading I am using gem Shrine.
I created a "demo code" ...
0
votes
0
answers
19
views
In Resque with Redis, how to get worker-id from job-id
We miss that info. We have 2 production machines, and we would like to know in which machine has been executed.
We have the job-id, like 9e806647228a11654d46fb0705c2d209, but... how do we know the ...
0
votes
0
answers
20
views
CircleCI Parallelism messing up with time-based tests
We have a big old build that is taking too long to run tests and Im trying to setup parallelism to speed things up. After the configuration, I can see the tests are indeed running in parallel and are ...
0
votes
1
answer
26
views
How to use Mongoid field type Set?
class Foo
include Mongoid::Document
field :bars, type: Set
end
f = Foo.new
f.add_to_set(bars: 1)
f.bars
=> nil
f.attributes['bars']
=> [1]
Is there any better way to access f.bars?
...
0
votes
1
answer
27
views
Why am I getting this wrong number or argument column sort error?
I followed this sortable column tutorial http://railscasts.com/episodes/228-sortable-table-columns?view=asciicast
The column sorting worked fine until I added in the helper section. I now get this ...
1
vote
1
answer
45
views
Rails.logger not working in ApplicationJob.before_perform
I'm using ActiveJob to manage my jobs, and I have the following ApplicationJob:
class ApplicationJob < ActiveJob::Base
# [...]
before_perform do |job|
Rails.logger.info 'before_perform ...