简体   繁体   中英

How does Active Record retrieve data from a database in Rails?

I've started to learn some Rails internals, and today I tried to find how Rails retrieves data from a specific database server.

If I ran a simple select query via an ActiveRecord model instance method, the ActiveRecord connection adapter generates this query as a SQL statement, and then I've got the data.

What kind of object in ActiveRecord is responsive for parsing data from the database server and wrap this data into an ActiveRecord object?

Where in the Rails codebase can I look for how this part works?

Please check out Railscast walkthrough on this topic:

http://railscasts.com/episodes/239-activerecord-relation-walkthrough?view=asciicast

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM