Category "ruby-on-rails"

Deploy via capistrano fail: "sudo: /bin/systemctl: command not found"

Now I'm transferring my environment following the below. Environment PreviousVersion NewVersion Rails 5.1.2 7.0.0 Ruby 2.4.1 3.0.0 capistrano 3.10.1 3.16.0 cap

Can't continue deploying after for while via capistrano

My environment is following the below. Environment Version Rails 7.0.0 Ruby 3.0.0 capistrano 3.16.0 Production environment Amazon EC2 Linux After for while fr

No route matches [GET] "/assets/application.js & No route matches [GET] "/assets/application.css

I am moving away from Webpack to Esbuild, using jsbundling-rails and cssbundling-rails. Rails version is 6.1.5 Everything seems to be working fine, but in my lo

openid-connect client in ruby with example code

I want to read data from an API which requires authorization with openid-connect. My client should be written in ruby, so I can use it in a task to import data

ActiveStorage::IntegrityError (Must supply api_key)

I have been building a Rails app with image uploads for user avatars and until now there were no problems. The app is hosted on Heroku and the service I am usin

Force yarn.lock to generate?

I have a rails app, I deleted yarn.lock (due to some complicated errors), but I would like to regenerate it. I tried yarn install -std:c++latest and yarn instal

Rails 7 - link_to with method :delete still performs GET request

I am trying to get this link to work, performing a DELETE request: <%= link_to "Sign Out", destroy_user_session_path, method: :delete %> However when I c

ActiveRecord Get Max Value Without Loading

I need to get the last record with a certain value, but without loading it. I have to do something like: Thing.where(cool: true).where(created_at: Thing.where(c

Does Unicorn Release Workers during I/O Wait

I have a rails 6 application using Unicorn. One of my endpoints handles image uploads to s3. For test purposes I have made a stack with a single web server runn

`result_exit_status': undefined method `-' for nil:NilClass (NoMethodError)

I am trying to add the Code Climate Test Reporter to a New Rails app that we are currently building. I have setup circleci on other projects so I modified the c

Rails upload a file - temporary file path needs file extension

I have an app that generates a PDF from react-pdf/renderer. Then the PDF is saved to ActiveStorage (utilizing Amazon S3). Some of the PDFs are too large though,

Don't serve error pages on Rails production

Is there a simple way to tell Rails (6) not to serve error pages (404/422/500) on production? I have all the static assets served by the reverse proxy and I'd l

'error Command "webpack" not found.' in Heroku deployment of Rails application

I'm having difficulty getting my Rails application deployed on Heroku. I've seen numerous similar posts but none of the suggested solutions has worked for me. E

nginx permission denied accessing puma socket that does exist in the correct location

On a Digital Ocean droplet running Ubuntu 21.10 impish I am deploying a bare bones Rails 7.0.0.alpha2 application to production. I am setting up nginx as the re

How to have a factory in multiple files

I have a model that is used by multiple libs, each of these libs is using it with different approaches. For the moment I made a factory file, which contains mul

Installing yarn on docker file: gpg: [don't know]: partial length invalid for packet type 63

I'm having more trouble installing Yarn. Install yarn global on Docker file In my last question, I found the steps to run after the image is first built but run

Still getting NotNullViolation despite belongs_to :foo, optional: true

I have a has_one and belongs_to association, like so: # teacher.rb has_one: :student and # student.rb belongs_to :teacher, optional: true but when I try to c

Trying to test (minitest) method that invokes AWS S3 Bucket copy_to. How to mock or stub?

We have an Attachment model with a copy_for_edit! method which helps an Attachment copy itself. The attachment data is stored in AWS S3 bucket(s). We make use o

Why are tests failing in Ruby on Rails?

I am studying the book "Agile Web Development with Rails 4". In it, at one moment associated with testing, it gives two errors Error: ProductsControllerTest#tes

Create grandchildren associations in the same Rails model

I want to get something like this in one class using ActiveRecord: grandfather = Person.create(name: "Grandfather") son = Person.create(name: "Son", parent: gr