python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Query deeply nested relations in rails
We have a lot of through relations in a model. Rails correctly joins the relations, however I am struggling in figuring out how to apply a where search to the joined table using active record.
For ins...
Anders
Votes: 0
Answers: 1
Modifying ActiveRecord models before preventing deletion
Some records in my application have a DOI assigned to them and in that case they should not be deleted. Instead, they should have their description changed and be flagged when a user triggers their de...
knirirr
Votes: 0
Answers: 1
Finding in array of active record results
I am using active record to create array.
users = User.all.to_a
now I want to later on find with in this array user id: 1
users.find(1)
but it is not giving result but returning everything. How can ...
shahidkamal
Votes: 0
Answers: 2
Rails is breaking SQL query when modifying order
Context
We have a Rails app that is retrieving conversations with the following raw SQL query:
SELECT sub.*,
profiles.status AS interlocutor_status
FROM (
SELECT DISTINCT ON (conversations.id...

lkartono
Votes: 0
Answers: 1