How does Rails ActiveRecord chain “where” clauses without multiple queries?

后端 未结 4 622
感动是毒
感动是毒 2020-11-28 02:26

I\'m a PHP developer learning the awesomness of Ruby on Rails, I\'m loving ActiveRecord and i noticed something really interesting, Which is how ActiveRecord methods detect

4条回答
  •  我在风中等你
    2020-11-28 03:16

    There are a number of methods that are known as "kickers" that actually fire off the query to the database. Prior to that, they just create AST nodes, which once kicked, will generate the actual SQL (or language being compiled to) and run the query.

    See this blog post for a deeper explanation of how this is done.

提交回复
热议问题