Most voted "active-record" questions
Active Record is a Pattern design for Orms (Object-Relational Mappers). The most popular implementation is the default Ruby on Rails web framework ORM.
Learn more…55 questions
Sort by count of
-
0
votes1
answer89
viewsActive record, how to replace Uniq with distinct correctly?
I’m trying to recover the months where I have answers to a survey this way: Answers.pluck('EXTRACT(MONTH FROM created_at)').uniq (0.7ms) SELECT EXTRACT(MONTH FROM created_at) FROM `answers` =>…
-
0
votes1
answer50
viewsHow to search for Entity and Daughters in a single sql
I have 3 classes that relate as follows: class AnamnesisModel < ApplicationRecord has_many :anamnesis_questions accepts_nested_attributes_for :anamnesis_questions end class AnamnesisQuestion <…
-
0
votes1
answer523
viewsJoin data from two tables per foreign key - Rails Activerecord
Hi, I have a Model Comment who is a belongs_to of User, and a Model Profile that also is a belongs_to of User. I can access User data easily through Comment.first.user, for example, but I would like…
-
0
votes2
answers363
viewsQuery and Subquery in codeigniter
Salve Galera , I’m breaking my balls to assemble this query in the IC model "SELECT *, geral_cnpj as cnpj, geral_mesref as mesref, (SELECT CEILING(( (SELECT `geral_valor_total` as valormes from…
-
0
votes0
answers31
viewsReturn group of objects by referencing the item in the postgres array field
I need a collection of objects having as reference the items of an array field in postgres, duplicating the person in the relationships she participates in. I am using Rails 6 and created the field…
array postgresql ruby-on-rails ruby active-recordasked 3 years, 12 months ago Carlos Fagiani Jr 160