The associations that Rails provides you gives some methods that would make your querying simpler, more readable, maintainable and effective.
Try writing two versions of a Customer-Orders application and then Customer-Order-Supplier 1) with associations and the other without and perform some different type of queries and see the beauty of queries where associations was exploited. From the queries executed you can also see the time they take from the Rails log. Then go into some more complicated examples to delve deeper. You can find some simple examples to start with in the Rails guides.
发布评论
评论(1)
Rails 提供的关联提供了一些方法,可以使您的查询更简单、更具可读性、更易于维护和更有效。
尝试编写两个版本的 Customer-Orders 应用程序,然后编写 Customer-Order-Supplier 1) 具有关联的版本,另一个版本不具有关联,并执行一些不同类型的查询,并了解利用关联的查询的美妙之处。从执行的查询中,您还可以从 Rails 日志中看到它们所花费的时间。然后进入一些更复杂的例子进行更深入的研究。您可以在Rails 指南中找到一些简单的示例。
The associations that Rails provides you gives some methods that would make your querying simpler, more readable, maintainable and effective.
Try writing two versions of a Customer-Orders application and then Customer-Order-Supplier 1) with associations and the other without and perform some different type of queries and see the beauty of queries where associations was exploited. From the queries executed you can also see the time they take from the Rails log. Then go into some more complicated examples to delve deeper. You can find some simple examples to start with in the Rails guides.