Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
44 views

Ransack query is returning wrong quantity of objects

I have this ransack query: SchoolTeacher.ransack(school_classrooms_id_eq: 1134).result.count it should filter objects of SchoolTeacher where classroom_id os 1134. SchoolTeacher belongs_to School. ...
Gabriel de França Tavares's user avatar
0 votes
1 answer
58 views

Rails lockbox and blind index, unable to access encrypted field

I have lockbox v1.3.3 / blind index v2.3.2 gems installed (have to use this version, can't upgrade at the moment). I am using rails 6.0.3.2 and ruby 2.6.9. I followed these steps: https://ankane.org/...
sckdd's user avatar
  • 21
0 votes
1 answer
62 views

Issue of User Duplication in Rails Application

I'm using 'rails', '~> 5.2.4', '>= 5.2.4.1' ruby '2.7.1' and gem 'pg', '>= 0.18', '< 2.0' I'm encountering an issue in my Rails application where some users are being duplicated in the ...
Philipe's user avatar
  • 21
0 votes
1 answer
50 views

How to write query for a condition on join table

I am trying to write a query using Rails ORM. Suppose there are two models. class College has_many :students class Student belongs_to :college The Student table has a column named result which can ...
Ravi's user avatar
  • 31
0 votes
1 answer
248 views

Rails ActiveRecord Rollback didn't happen where it is expected to happen when there is an exception

Let's say I have a object named book. once book.save! is given all the model callbacks will be triggered according to the rails order defined. In my case API request timeout exception happened in the ...
Priyadharshini Raja's user avatar
0 votes
0 answers
61 views

Rails 6 Active Storage Image Variants

I am encountering an ActiveRecord::NotNullViolation exception when trying to create an image variant using ActiveStorage in my Rails application. The issue arises specifically when I attempt to ...
user10895732's user avatar
1 vote
1 answer
62 views

How to add validation only to an associated table in active record

I have an address table in rails: class Address < ApplicationRecord validates :street, :city presence: { allow_blank: false } end the table is associated with several tables and I ...
Davi Luis's user avatar
  • 426
0 votes
1 answer
31 views

How to connect in a visual fashion to MySql that is behind a reverse proxy?

Before of the Rails Kamal-Docker advent I was used to connect from my local machine to the remote MySql production database by using MySql Workbench. Now I've my database on the remote server placed ...
user502052's user avatar
  • 15.1k
0 votes
1 answer
45 views

Tidy Up Rails Postgres Production Database

I have moved a column (called score) from one table (contract) to another (weekly_record). I created a new migration for weekly_record. However I removed it from the original table 'by hand', ...
Daniele Deltodesco's user avatar
1 vote
2 answers
64 views

Rails edit.html.erb form not pre-loading data for inputs with empty select option

I have a rails application that has 2 forms that edit the same table. The first form is in new.html.erb for basic information filled with text fields. Then the second form is edit.html.erb which is ...
auto's user avatar
  • 1,113
0 votes
2 answers
75 views

How can I prevent n+1 issue from array that is generating additional conditions?

I'm facing n+1 issue when using conditions on array that comes from includes query. Here are the following tables: rems |id| |name| 1 aaa 2 bbb rem_correlatives |id| |rem_id| |name| |deleted| |...
Carlos Morales's user avatar
0 votes
1 answer
47 views

Ruby on Rails: How do you create a `has_one` relationship with duplicating primary keys?

I have 2 Tables: Dogs - id (primary key) Cats - id (primary key) I would like to introduce a third table let's say Collars, that both dogs and cats have: Collars: - id (primary key) - size ...
Wallace's user avatar
  • 127
-1 votes
1 answer
73 views

how to design db schema for if-else-then condition

first of all, I am sorry in advance for my bad english. It would be difficult to understand what I'm trying to say, but I will try my best to explain what i want to ask. **my question is how to design ...
destiny1616's user avatar
-1 votes
2 answers
115 views

Optimizing Rails API Controller for Improved Performance

module Api module V1 class AngularDashboardApisController < BaseController include RolesHelper before_action :verify_auth_token before_action -> { verify_user_permission(...
Ridham Patel's user avatar
0 votes
1 answer
45 views

I want to sort data into descending order in rails app and I used sqlite3 database. So is there any order_by available in rails

/home/dell/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8/lib/active_record/dynamic_matchers.rb:22:in method_missing': undefined method order_by' for User:Class (NoMethodError) Did ...
Govind Patidar's user avatar

15 30 50 per page
1
2 3 4 5
261