A belongs_to relationship creates a one-to-one correspondence with another model. In database terms, this relationship says that this class contains a foreign key. If the foreign key contains another class, has_one should be used instead. Methods added by belongs_to When you declare a belongs_to relationship, the declaring class automatically receives five methods related to the […]
Tag: ruby on rails install
Rails caching management
All communication methods are built around caching, which keeps the results of recent requests available for future operations. The cache is shared between different methods. For example: author.books # get books from database author.books.size # use the cached copy of the books author.books.empty? # use the cached copy of the books But what if you […]