README.md in cached_belongs_to-0.0.1 vs README.md in cached_belongs_to-0.0.2
- old
+ new
@@ -1,6 +1,6 @@
-# CachedBelongsTo
+# Cached belongs_to
[![Build Status](https://secure.travis-ci.org/crowdint/cached_belongs_to.png)](http://travis-ci.org/crowdint/cached_belongs_to)
Back in the 80's disk space was precious. That's why we came out with table "normalization" for relational databases.
@@ -25,21 +25,28 @@
$ gem install cached_belongs_to
## Usage
-Just use it as you would use `belongs_to`. Add the `:caches` option to specify the
+Currently, it works with a traditional `belongs_to` - `has_many` associations
+between two models.
+
+Just use it as you would normally use `belongs_to`. Add the `:caches` option to specify the
fields in the association that you want to cache.
#
# table: authors
+ # name:string
#
- # name:string
- #
class Author
has_many :books
end
+ #
+ # table: books
+ # author_id:integer
+ # author_name:string
+ #
class Book
cached_belongs_to :author, :caches => :name
end
You will need a database field in the books table to hold the cached value: