Category "ruby-on-rails"

In Rspec, how do I set the VCR record mode in the feature description?

I have a test that uses VCR like this: describe 'Do something with an api', feature: true, js: true, vcr: true do end I want to set this vcr recording to the op

How can I disable Hotwire / Turbo (the Turbolinks replacement) for all forms in a Rails application?

In Rails 7, Turbolinks is replaced by Hotwire / Turbo. This patches up web links so that they become AJAX-style requests just like Turbolinks did, but also patc

Order AR by enum and after, a random list

I have a user model with enum level and an each user has_many books enum level: { member: 0, supporter: 1, pro: 3, partner: 4 }, _prefix: :level I would like

Associate Active Record tables through non-primary, non-unique column in Rails

I have a table "films" whose schema looks like this: create_table "films", force: :cascade do |t| t.integer "tmdb_id", null: false t.string "language_is

Associate Active Record tables through non-primary, non-unique column in Rails

I have a table "films" whose schema looks like this: create_table "films", force: :cascade do |t| t.integer "tmdb_id", null: false t.string "language_is

couldn't find file 'owl.theme.default' with type 'text/css' error in rails 5.1.4

im getting the below error. Sprockets::FileNotFound at / couldn't find file 'owl.theme.default' with type 'text/css' Checked in these paths: /home/xyz/abc/pr

conditionally have css tag inline in slim

I have a set of css tags like this: .card.hidden.small.u-margin-bottom-1 I'd like to conditionally show the .hidden tag while maintaining this style of syntax

BUILD FAILED (Ubuntu 20.04 using ruby-build 20210119)

I'm using rbenv and in Ec2 instance I'm trying to install a ruby different version but when I execute rbenv install 2.7.2 following errors occur. Downloading

How to pass a File JS object to Rails controller

I have a JS file object (like the one below) that I'd like to pass to my rails controller. File {name: 'undefined', lastModified: 1652457009460, lastModifi

Allowing ruby buildpack on Heroku to use Yarn cache

I'm running a Ruby on Rails + Webpacker app on Heroku with Yarn v2 and hitting some issue with dependency caching. It seems that Yarn dependencies are reinstall

Rails 6.1.5: uninitialized constant Mail::TestMailer

Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.

How to disable Pry autocomplete?

I would like to disable autocomplete in Pry. How to do it? I'm using it in Rails console(from Emacs/inf-ruby) and it is very slow and annoying in my legacy app.

Node module css import paths work in development, but not in production

I am moving from Webpack to esbuild with jsbundling-rails & cssbundling-rails. I have a folder which imports css libraries from vendors like so: @import "dr

Active storage problem - replacing pictures

I'm using:ruby 2.6rails 6.1.4devisedevise_token_authactive-storage usingl locally disk service I'm creating api in which I can storage and upload pictures. I ca

POST api request in two models in Ruby on rails

I would like users to be able to create a booking, and give it a partner (BookingPartner) in the same request, similar to this "booking": { "address": "

Error on reify a version using ruby PaperTrail

I followed the instructions in https://github.com/paper-trail-gem/paper_trail Added the paper_trail gem in the project Gemfile: gem 'paper_trail' Executed the

Rails Bootstrap 4, dropdown stops working after pressing back button on browser

I'm using Ruby on Rails 6, and I'm importing bootstrap from the application.html.erb file. The dropdown stops working when I press the back button on the browse

Can I make a modification to a child force a validation on a parent when using Active Record Autosave Association?

I am looking for how to trigger a validation on a parent when a child is modified or deleted. Some background in case I am asking the wrong question: I am tryin

Upgrade Ruby 2.6 to 2.7 - WebMock no longer recognizes RegEx patterns on stub requests

I am upgrading a Rails 6.1.4 application from Ruby 2.6.10 to Ruby 2.7.6. With Ruby 2.7.6, WebMock no longer matches the Regular Expressions that worked perfect

Hide default value in form Ruby

I have a form and when I set a value, the value is displayed in the field, how to not display the value but keep the existing values when submitting the form: H