Category "ruby-on-rails"

How to make data:{confirm..} work in rails 6 | button_to

my confirm popup not working in rails 6. I added gem 'jquery-rails' to GEMFILE and run bundle install. I also added //= require jquery //= require jquery_ujs t

CKEditor: [CKEditorWebpackPlugin] Error: Too many JS assets has been found during the compilation

I am updating the CKEditor packages in my Rails/React app from ~12 to the latest version 27. When running the app locally in my webpack-dev-server I see this e

Rails helper doesn't have access to base class method

I've got helper which I'm including inside Create service class. This Create service inherits from Base class and I'm including ::Imports::HashFieldsBuilder to

Rails/Heroku, switching between databases multiple times yields "can't create Thread: Resource temporarily unavailable" error

Setup: Ruby 2.5.9, Rails 5.2.2, Heroku-18, Postgres Issue: I'm running a task on my Heroku staging database which compares data from two different databases (bo

How to call confirm prompt using button_to in Rails with Turbo

Previously in Rails when using the button_to tag, it was possible to use a confirmation dialog like this <%= button_to 'Destroy', @post, method: :delete, dat

ActiveJob custom serializer - uninitialized constant NameError

I am trying to add a custom serializer to ActiveJob following the ActiveJob Rails Guide. I have the following class, originally in the file app/lib/money_serial

Error when trying to include Devise::Test::ControllerHelpers

I'm trying to get started with controller tests, and I'm not sure what I'm doing wrong. Here's my code, and the error it's producing: require 'test_helper' cla

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