diff options
-rw-r--r-- | activerecord/CHANGELOG.md | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/statement_cache.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index cf697d8b16..aa156f5d4f 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,13 +1,13 @@ ## Rails 4.0.0 (unreleased) ## * Added Statement Cache to allow the caching of a single statement. The cache works by - duping the relation returned from yielding a statement which allows skipping the AST - building phase. + duping the relation returned from yielding a statement, which allows skipping the AST + building phase for following executes. The cache returns results in array format. Example: cache = ActiveRecord::StatementCache.new do - Book.where(:name => "my book").limit(100) + Book.where(name: "my book").limit(100) end books = cache.execute diff --git a/activerecord/lib/active_record/statement_cache.rb b/activerecord/lib/active_record/statement_cache.rb index 4a8c54414d..8c4b4f666b 100644 --- a/activerecord/lib/active_record/statement_cache.rb +++ b/activerecord/lib/active_record/statement_cache.rb @@ -4,7 +4,7 @@ module ActiveRecord # Initializing the cache is done by passing the statement in the initialization block: # # cache = ActiveRecord::StatementCache.new do - # Book.where(:name => "my book").limit(100) + # Book.where(name: "my book").limit(100) # end # # The cached statement is executed by using the +execute+ method: |