Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
47 views

How to use active_storage blob with image_processing without temporary files on disk?

using Rails 7.2.1.1 and Ruby 3.3.5. Gemfile has gem "image_processing", "~> 1.13.0". Basically I have a form that allows the company logo to be uploaded, and needs to accept ...
NGobin's user avatar
  • 354
0 votes
3 answers
46 views

Rails STI through model using polymorphic - populates source_type from parent class

Using Rails 7 I am using a Single Table Inheritance (STI) to store some very simple associations. The source object uses has_many associations with the STI models. Following some advice in question ...
ReggieB's user avatar
  • 8,212
1 vote
0 answers
11 views

Rails Client-side form checkbox validation: at least one value must be chosen

How do I check from the client-side if there is at least one checkbox being ticked here? = form_with model: @form, url: generate_matches_tournament_path(@tournament), method: :post, local: true do |f| ...
Nguyên Vũ Trịnh Lê's user avatar
0 votes
0 answers
37 views

Rails 7 - ExecJS::RuntimeError: SyntaxError: Unexpected token: operator (=) - production assets:precompile error

Upgrading chart.js from version 2.9.4 to 4.4.4. Locally(Machine is MAC OS), rails app is generating charts with upgraded version. When deploying to AWS EC2, Jenkins build is failing with this error ...
Mansi Shah's user avatar
0 votes
1 answer
37 views

Tableless model in Rails 7

I am upgrading a Rails app from Rails 3.2 to Rails 7 (don't ask!!). There is a tableless model that was using this gist, but it's no longer working. It looks like the suggestions here no longer work ...
H.Kh's user avatar
  • 1
0 votes
0 answers
25 views

ReferenceError: Rails is not defined when importing @rails/ujs in Rails 7

I'm new on using Ruby on Rails and I'm a bit confused on how to import @rails/ujs. This is my app/javascript/application.js code: import Rails from "@rails/ujs"; import Turbolinks from "...
NiviEnec's user avatar
0 votes
0 answers
41 views

Recaptcha v2 always false. Ruby on Rails 7

I tried to add recaptcha on site and i use gem for that. I use recaptcha v3 and if it fails then i add v2 to the form.like that: $("#captcha-v2-<%= @modal %>").html("<%= j ...
w1cked's user avatar
  • 1
1 vote
0 answers
17 views

No connection pool for 'ActiveRecord::Base' found for the ' ' role

I upgraded our rails application from version 6.0 directly to 7.0. After commenting out the new framework defaults everything seemed to work smoothly but after setting the load_defaults to 7.0 I got ...
egli's user avatar
  • 11
1 vote
2 answers
182 views

Possible to remove method in ActiveRecord?

Context: Rails 7.1, only using the DB interaction layers, no web framework, no servers, etc... I'm sure this is going to ruffle a few feathers, but I keep running into ActiveRecord::...
yenadar's user avatar
  • 25
0 votes
1 answer
34 views

Eager Loading Child Records with Specific Condition

class User < ApplicationRecord has_many :description_hoge_projects, -> { where(description: "hoge") }, class_name: "Project" end users = User.preload(:...
Topotan's user avatar
  • 91
0 votes
0 answers
52 views

Rails 7 chart.js upgrade from version 2.9.4 to 4.4.4 - Uncaught ReferenceError: Chart is not defined

I am trying to upgrade chart.js from version 2.9.4 to 4.4.4. Javascript is managed by Yarn tool. Package.json file `"chart.js": "^4.4.4",` Application.rb file had this path for ...
Mansi Shah's user avatar
-1 votes
0 answers
54 views

How to create a tab where each tab renders a different controller?

I have a tab where the first tab renders the devise controller (edit.html.erb view) and the second one I want to render the ChartsController. How can I do this in Rails 7? My code: edit.html.erb: <...
Elton Santos's user avatar
-1 votes
2 answers
50 views

ActiveStorage - Rails API Only

I have a rails-api-only application and want to upload a Logo. Using Rails 7, Ruby 3.1.2 Gem "image_processing", "~> 1.2" Able to upload Logo and retrieve the original logo ...
Gourav's user avatar
  • 566
0 votes
1 answer
28 views

belongs_to :through collection association that all belongs to same object

I have the following classes: class Order has_many :line_items end class LineItem belongs_to :order has_many :line_item_production_items has_many :production_items, through: :...
Zyren's user avatar
  • 663
0 votes
1 answer
151 views

ActionMailer NoMethodError for preview_path

After upgrading from Rails 6 to 7, I'm getting this error when trying to test out a mailer that was working just fine before. NoMethodError (undefined method `preview_path=' for ActionMailer::Base:...
brokenbells's user avatar
0 votes
1 answer
88 views

Problem loading files using importmaps in rails 7

I am working on a rails 7 app that is using importmaps for all JS related stuff. For reference, I am giving the code below. importmap.rb # Pin npm packages by running ./bin/importmap pin "...
Muhammad Ans's user avatar
1 vote
1 answer
39 views

SendGrid and Rails 7, Heroku in Production error

I have a Rails 7 app using Ruby 3.2.2 up on Heroku. It uses SendGrid to send thank you emails when someone signs up for the newsletter of fills out the contact form. I have the SendGrid account ...
BETAdata's user avatar
0 votes
1 answer
41 views

How do I order by lower-cased field on an aliased association without manually specifying a join?

I have the following models, with matching tables and FKs. class Organization < ActiveRecord end class Identifier < ActiveRecord belongs_to :owner, class_name: "Organization" ...
UsAndRufus's user avatar
0 votes
0 answers
39 views

Cannot load custom ActiveJob serializer unless I require the file explicitly

Using Rails 7.2.1. Documentation on custom serializers for ActiveJob is pretty concise. It lacks context on how letting Rails to pick them up though. I'm having issues with this part. My serializer ...
Sebastialonso's user avatar
0 votes
2 answers
81 views

401 Unauthorized with Devise basic auth

I made a Rails install 7.2.1, installed Devise basic. I set in my applications controller: def after_sign_in_path_for(current_user) # Assuming 'Dashboard' is a model and you have a show action ...
Havic's user avatar
  • 109
0 votes
0 answers
51 views

rails : how desabled override accessor when update

I have a methode to overide a field in category model : def foo _foo = read_attribute(:foo) _foo = competition.foo if _foo.nil? _foo end in controller, the update function : category.update(...
Matrix's user avatar
  • 3,489
0 votes
1 answer
58 views

No route matches [GET] "/users/sign_out" i can delete my account but not log out

Here is my error: No route matches [GET] "/users/sign_out" and this is all routes : Prefix Verb URI Pattern ...
Samy Bellili's user avatar
1 vote
1 answer
40 views

Can I switch to Amazon S3 later in Rails 7 after using local storage?

If I'm using the server's local storage for storing images, can I access those local images later when I switch to Amazon S3 plan?
John Sall's user avatar
  • 1,129
0 votes
1 answer
34 views

Where are those schema.rb discrepancies coming from?

My whole team is using docker so we have similar versions, some people are on Linux and some on Mac. When I call rails db:schema:dump I see few discrepancies in the resulting diff: The 1st kind is ...
Greg's user avatar
  • 6,475
0 votes
0 answers
30 views

Skip/Add acts_as_list conditionally

I am using a single model for acts_as_list, not sure if it is mandatory to add an associated model. class TestModel < ApplicationRecord # need to skip adding a value to position for a specific ...
Tanay Sharma's user avatar
  • 1,148
0 votes
1 answer
48 views

Rail Upgrade to 7.1.4, NoMethodError for jsonb field in Postgres Db

Upgrading a project from Rails 5.2, made it to 7.1.4 and it's producing an odd issue serializing jsonb. Given the lack of information I've found, this appears to be an unusual issue. The error ...
Kinitawowi's user avatar
0 votes
1 answer
135 views

How to include stylesheets from a gem in Rails 7.2

I'm using the simple_calendar gem and it's working great. I'm having trouble getting it to import the stylesheet by doing application.css *= require simple_calendar or application.tailwind.css @...
vince's user avatar
  • 2,768
0 votes
1 answer
101 views

Rails Internationalization (I18n) + Turbo Streams: how to change the locale for Turbo Streams?

TL;DR: the components updated with Turbo Streams in my Rails app always use the default locale instead of the currently set locale. I have a Rails application with multiple engines. I'm implementing ...
pabvald's user avatar
  • 11
0 votes
1 answer
34 views

uninitialized constant API::V2::BaseController::UserApiAccessRecorder when including a concern module in controller

I am including a concern in a controller: # app/controllers/api/v2/base_controller.rb class API::V2::BaseController < ActionController::Base include UserApiAccessRecorder end # app/controllers/...
tomwang1013's user avatar
  • 1,425
0 votes
0 answers
38 views

How to validate uniqueness with scope when model belongs to a model that belongs to another model

I have a simple situation where we need to have unique SKUs for items for sale. A location has many products and a product has many variants. The SKUs for each variant has to be unique for a location. ...
vince's user avatar
  • 2,768
0 votes
1 answer
45 views

ActiveRecord query for has_many :through with Enum

I have a simple has_many through: table class User < ApplicationRecord has_many :memberships end class Membership < ApplicationRecord enum :status, [:inactive, :active] belongs_to :user ...
vince's user avatar
  • 2,768
-1 votes
1 answer
278 views

Rails 7 link_to always triggers Turbo Stream for POST request, even with data: { turbo: false }

In my Rails 7 app, I'm trying to make a link_to trigger a normal POST request, but it always ends up sending a Turbo Stream request. I've tried disabling Turbo by adding data: { turbo: false }, but ...
Tiago Antunes's user avatar
0 votes
0 answers
41 views

Cloud run seems to timeout and generate HTTP 304 responses for application endpoints that don't check last modified headers or other etags

I have a Rails application on cloud run with an endpoint called by our apps to determine if their version is current and if not, requires a download. This is a simple, one record read of the database ...
Daniel McCarty's user avatar
3 votes
1 answer
395 views

ArgumentError: assert_no_enqueued_jobs requires the Active Job test adapter, you're using ActiveJob::QueueAdapters::SidekiqAdapter

We've been looking to upgrade to Rails 7.2.0 and we're getting a new error in MiniTest (v 5.24.1). ArgumentError: assert_no_enqueued_jobs requires the Active Job test adapter, you're using ActiveJob::...
Phil-6's user avatar
  • 785
1 vote
1 answer
184 views

How to alias `reload!` in rails 7.2 console?

I had an alias for reload! command in the rails console: # ~/.irbrc if defined? Rails def r reload! end end In rails v7.2 this no longer works: >> r (stackoverflow):1:in `<main>':...
Alex's user avatar
  • 28.8k
0 votes
1 answer
99 views

Configuring the console via IRB

I have some code that I would like to automatically execute on a per-project basis when I start up rails c. In one of my Rails 6 projects, I just created a .irbrc file at the top-level of the project, ...
Ryan Pierce Williams's user avatar
0 votes
0 answers
82 views

Article.current_transaction.after_commit outside of a transaction: whats the point?

In Rails 7.2, they introduce Article.current_transaction.after_commit, saying "for code that may run either inside or outside a transaction and needs to perform work after the state changes have ...
Mohamed Hafez's user avatar
0 votes
0 answers
42 views

Rails 6 to 7 upgrade javascript not loading

I am trying to upgrade a project from Rails 6 to Rails 7. Gemfile ruby '3.1.2' gem 'rails', '7.0.4' gem "sassc-rails", '2.1.2' gem "sprockets-rails", "3.4.2"...
Bazley's user avatar
  • 2,827
1 vote
1 answer
46 views

stylesheet_link_tag with path, not only the file name

I am adding some extra CSS/JS files into my vendor folder: vendor/my_theme/css/app.css vendor/my_theme/css/bundle.css vendor/my_theme/js/app.js They belong to an external theme I am integrating. I ...
fguillen's user avatar
  • 38.5k
0 votes
1 answer
55 views

Elasticsarch - How Do You Build A Search Query For An Object With Two Keys?

I have an Elasticsearch index with an array of items that looks like: [{ ..., "_source": { "id": .... "name": "apples", "organization_size&...
Lloyd Banks's user avatar
  • 36.5k
0 votes
1 answer
105 views

issue with image processing & mini magic gems in rails 7 while creating image variants in active storage

in my rails Application I have the following code. class ProjectImage < ApplicationRecord belongs_to :project has_many_attached :images do |attachable| attachable.variant :...
John's user avatar
  • 1,323
0 votes
0 answers
40 views

Is there a way to access session stored in redis in log configuration stage in rails?

I have a rails 7 web app, which uses redis, hiredis, redis-actionpack to store session data. We also use devise for auth. Now, I wish to use log tags to include user_id in every line the logger logs. ...
Shrinath's user avatar
  • 8,088
0 votes
0 answers
27 views

Form not submitting unless I refresh the page - Rails 7 - Chrome

The form_for (inside a modal) cannot be submitted unless I refresh the page. It seems like the submit button is disabled or not working properly. I have tried disabling Turbo by adding data-turbo=&...
Antoine Mauriac's user avatar
0 votes
0 answers
48 views

ActionText is blocked , can anyone explain why this is happening?

Recently, I migrated the whole codebase from Rails 5.2 to 7, but the folder structure is still the same as the earlier version. I also implemented ActionText, but the text field is blocked when I try ...
Shiv Shankar Singh's user avatar
0 votes
0 answers
39 views

Rails 7 with turbo - some requests on Chrome/FF doesn't work correctly

It happens only on Chrome/Firefox - on Safari everything works fine. I noticed that some requests (eg. file upload) don't work correctly after moving to turbo (from turbolinks). Request: patch https://...
Magda Sz.'s user avatar
  • 161
0 votes
0 answers
99 views

Upgrading ruby version from 3.0.0 to 3.1.0 is throwing uninitialised constant Time::RFC2822_DAY_NAME error

Current Rails app has ruby 3.0.0 and trying to upgrade to ruby 3.1.0. It's breaking with uninitialised constant Time::RFC2822_DAY_NAM error where it was previously working properly. That line is ...
Mansi Shah's user avatar
0 votes
1 answer
56 views

Apartment Gem + Rails 7

I'm trying to install apartment gem but its giving error. When I do bundle exec rails generate apartment:install it produce error undefined method `new' for "Apartment::Reloader":String (...
H.M.BILAL's user avatar
0 votes
0 answers
57 views

Rails 7.1 redirect_to(Shibboleth Logout) is not working

I am not sure how to debug Rails 7.1, redirect_to() not working vs in Rails 3.2 the same exact code works. Working Example Within Rails 3.2, I have a Controller action "logout" that contains ...
Chris's user avatar
  • 413
0 votes
1 answer
346 views

Rails 7 error during application start - Zeitwerk-related errors

I'm upgrading my rails app from 6.1 to 7.0 and i'm running into this runtime error: I do use the Authlogic gem, but the odd thing is i have no config/initializers file for Authlogic, and i can't find ...
weetch's user avatar
  • 131
0 votes
0 answers
322 views

Ruby (3.3.4) and Rails (7.1) - rails s Zeitwerk - uninitialized constant Utils::ScriptsUtils::Utils (NameError)

I am trying to update my ruby app from ruby 2.6.6 to ruby 3.3.4 and Rail 5.1 to Rails 7.1 I know it is not a good practice to do so, but in my case (which is a bit complicated) I felt I didn't have ...
bseido's user avatar
  • 19

1
2 3 4 5
20