Questions tagged [ruby-on-rails]
Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.
ruby-on-rails
44
questions
0
votes
0
answers
22
views
N+1 issue when listing attachement and variants(has_many_attached)
N+1 query issue is coming at the time of fetching variant.
Model:
# Yoyaku Shouhin model
class YoyakuShouhin < ApplicationRecord
has_many_attached :shouhin_images do |attachable|
attachable....
-1
votes
0
answers
9
views
Library is unable to encode image files to the Webp files
Currently, I'm using webp-ffi gem to convert PNG/JPG files to webP files for better performance, it was working fine but suddenly, the library stopped working and it is raising the below exception
...
0
votes
1
answer
60
views
Is it valid practice to intentionally omit association definition with Rails ActiveRecord? [closed]
While been working on Ruby on Rails application, I was suggested to omit ActiveRecord association intensionally by my coworker for it's defines unnecessary methods.
Example,
class Person < ...
1
vote
1
answer
35
views
How can I make Tailwind work on my component
Good morning everyone. I'm trying to render a FlashMessage component
<% flash.each do |type, message| %>
<%= render FlashMessageComponent.new(type: type, message: message) %&...
0
votes
1
answer
24
views
Generating an I18n attribute in a json jbuilder flow
The following, in a context where the Mobility gem is used for handling translation of values.
json.label transaction.categoryminor.name
is generating a value, which would be blank as Mobility ...
0
votes
0
answers
22
views
puma-dev server error 'Unable to start worker'
I am trying to get puma-dev server working locally, and im hitting an issue. If I tail these logs tail -fn 2000 ~/Library/Logs/puma-dev.log I can see this error once I hit the first webpage and try to ...
1
vote
1
answer
28
views
Checking if authentication in required on a page using Rails and Devise
I have a Rails 6.1 application that uses Devise for authentication.
In my application_controller.rb I by default require authentication on all pages:
class ApplicationController < ActionController::...
0
votes
1
answer
24
views
Short session duration in Rails 7 PWA
My Rails 7 PWA is logging me out:
Any time I force close the PWA, and
After just a few hours even if the PWA is left running in the background
This only happens in the installed PWA on a mobile ...
0
votes
0
answers
23
views
rails docker temp folder permission issue
i'm having an issue with my rails app deployed with docker. Every time app goes through a code using tempfile like (Tempfile.new) it raises an error .
system temporary path is not writable: /tmp
11:00:...
0
votes
0
answers
27
views
NGINX returns 404 for the image files with extension but renders without extension
I'm using active storage to upload files and using nginx for the request routing. I have added file upload functionality in my application which was working fine when using S3. Now I have switched to ...
-1
votes
1
answer
23
views
How to use an OAuth-secured API with a Vue.js client?
Current state
I have an app with this architecture:
Ruby on Rails application, serving an API using grape, secured with OAuth by gems wine_bouncer and doorkeeper
an Angular webapp using angular-...
0
votes
1
answer
29
views
Two Ways to Include Associated Models in a Serializer
This is My Models.
class Patient < ApplicationRecord
has_many :patient_segments
has_many :segments, through: :patient_segments
end
class Segment < ApplicationRecord
has_many :...
0
votes
1
answer
57
views
ActionController: Which params are set by Rails?
In a JSON API Controller, I use a before_action to check if any key of params is not allowed for that action and respond with a 400 error in case any of the given keys are not allowed.
However, simply ...
0
votes
1
answer
14
views
intl-tel-input with Ruby on Rails and webpack: Cannot find module '../img/flags.webp'
I'm using Ruby on Rails 6 with webpacker. I'm upgrading intl-tel-input from v17 to v23, following the README setup.
/* app/assets/stylesheets/intl-tel-input.scss */
@import '~intl-tel-input/build/css/...
0
votes
0
answers
49
views
Turbo Stream Response Only Works On Show | Rails 7.1
Part One:
This is my controller action -
def update
respond_to do |format|
if @user.update(user_params)
format.turbo_stream { redirect_to user_url(@user), notice: "...