Category "ruby-on-rails"

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

rails new cssbundling-rails gem issue with images on production

I'm testing the new rails cssbundling-rails gem. I'm following the default config, but on prod, I'm getting a 404 error with the images path in the .scss files

How do I troubleshoot "wrong number of arguments" in solidus affirm

Struggling to get solidus_affirm working and hoping anyone might have some ideas. I always have trouble with "wrong number of arguments" errors like this. Can g

Turbo Drive not intercepting links (but turbo:load event fires)

I'm experimenting with adding Turbo to a Rails 6.1 app. It seems to be loading (see "What I've tried"), but when clicking around the clicks does not seem to be

RoR App: “The asset 'application.css' is not present in the asset pipeline”

Info: Rails 6.1.4 Ruby 3.0.1 PostgreSQL 9.6 NodeJS 11.15.0 Yarn 1.22.5 when I start my APP I always got the same error: I've tried all I saw in others posts bu

Rails - a way to check the last line while using smarter_csv gem

I am using smarter_csv gem to parse a large CSV file on Heroku. SmarterCSV.process(file_name, { chunk_size: 10, headers_in_file: false, user_provided_headers: u

Gem to local libray in Rails

My boss asked me to write a gem to wrap an API (canvas) consumer for our app, I did it and it works, but in the last minute he asked me not to use the gem appro

rspec describe a rake task namespace

I want to test a specific namespace of rake tasks and I am getting an error from rubocop. desc 'This namespace is test' namespace :test_namespace do task tes

Login with devise-jwt authentication?

I cannot figure out how to send a post request to login on devise with devise-jwt I use devise as web authentication, but want to add an endpoint for api authen

Rails: Webpacker::Manifest::MissingEntryError in Home#index

Webpacker::Manifest::MissingEntryError in Home#index Showing /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/app/views/layouts/embedded_app.html.er

Rails: Webpacker::Manifest::MissingEntryError in Home#index

Webpacker::Manifest::MissingEntryError in Home#index Showing /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/app/views/layouts/embedded_app.html.er

RailsTutorial 13 --- Image doesn't show on the web page after uploading it through AWS S3

I am a newbie and just started to learn coding with RailsTutorial. I use AWS C9 Ubuntu as is instructed. At the end of chapter 13, there is an instruction for A