TL;DR: Is it OK to specify a schema in table_name_prefix? We have a large Rails application that is not quite a traditional multi-tenant app. We have a hundred
I want to query an ActiveRecord model, modify it, and calculate the size of the new object in mb. How do I do this?
I try to change the default column value from false to true. But when I run rake db:migrate VERSION=904984092840298 I got the following ERROR. StandardError: A
What is the best way to find records with duplicate values across multiple columns using Postgres, and Activerecord? I found this solution here: User.find(:al
enter image description here Upgraded rails from 6.0.3 to 6.1.5 but having issues with query methods like eager_load and references. class Note < Application
I have a simple has_one relationship class User < ApplicationRecord has_one :detail has_many :courses end class Detail < ApplicationRecord belongs_
The difference between after_create, after_save and after_commit in Rails is that: after_save is invoked when an object is created and updated after_commit is
I am creating a ActiveRecord transaction this way ActiveRecord::Base.transaction do MyModel.create!(name: "value") OtherModel.create!(name: "value") end
I already have a working solution, but I would really like to know why this doesn't work: ratings = Model.select(:rating).uniq ratings.each { |r| puts r.rating
Rails 3.2 app running on Heroku with Postgres. I added an index add_index :lines, :event_id Events have_many Lines. There are about about 2 million Lines and
I'm working on the project where we are using :sql schema format for the Active Record dumper (to support more complex logic like triggers). We have a lot of