← Back to Upcase

Can't find where and how activerecord retreives data from db in rails


(Iurii Plugatariov) #1

X-post my question from stackoverflow.
I’ve started to learn some Rails internals, and today I’ve tried to find out how rails retrieves data from specific db server. Let’s imagine we’ve fired simple select query via ActiveRecord model instance method, AR connection adapter generated this query to SQL statement, and then we’ve got the data. But the question is, what kind of object in AR module is responsive for parsing data from specific db server and wrapping this data into AR object? Where in rails codebase I can look through how this part of flow works?


(Iurii Plugatariov) #2

Lol. Seems to me that I’ve wrote kinda incorrect question. And found out an answer. My question was how tuples provided by SQL query(generated via AR query interface), are parsed and delivered to rails application. To understand this process the best way for me was to look through pg gem(it can be any other database driver gem).