0
I’m having trouble adjusting performance when returning json after a database query.
I’ve tried a lot of things, and I’m not getting any faster.
Someone can give me a boost with this ?
This is the query in the controller

Method in the model

Rabl

0
I’m having trouble adjusting performance when returning json after a database query.
I’ve tried a lot of things, and I’m not getting any faster.
Someone can give me a boost with this ?
This is the query in the controller

Method in the model

Rabl

0
As recommended by Carvalho paste your code into text. It will be much simpler to help you and you will get help easier and faster if you do it the right way.
About your code. One of the things I’m fixing is that you’re using SQL to scan the entire table and then handle it. Try to minimize bank efforts in the array.
Come on, I’d trade these methods for this
def students
works_students.where.not(student: nil)
end
def program_id
Qrcode.find_by(code: self.teacher_qrcode).try(:program_id)
end
I don’t know about the rest. I’d have to take a closer look at your implementation.
I do not know better to create an association of has_one :qrcode in the model Teacher?
Having an association you could directly access the code by the controller so:
work.teacher.qrcode.program_id
Browser other questions tagged json ruby-on-rails ruby active-record
You are not signed in. Login or sign up in order to post.
Hello prefer to post your code in text instead of copy and paste a print of it.
– Luiz Carvalho