From 761bc751d31c22e2c2fdae2b4cdd435b68b6d783 Mon Sep 17 00:00:00 2001 From: Toshiyuki Kawanishi Date: Sat, 15 Sep 2012 17:39:11 +0900 Subject: Fix find_in_batches with customized primary_key --- activerecord/CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 8c99a3929e..71dc960309 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,20 @@ ## Rails 4.0.0 (unreleased) ## +* Fix `find_in_batches` when primary_key is set other than id. + You can now use this method with the primary key which is not integer-based. + + Example: + + class Post < ActiveRecord::Base + self.primary_key = :title + end + + Post.find_in_batches(:start => 'My First Post') do |batch| + batch.each { |post| post.author.greeting } + end + + *Toshiyuki Kawanishi* + * You can now override the generated accessor methods for stored attributes and reuse the original behavior with `read_store_attribute` and `write_store_attribute`, which are counterparts to `read_attribute` and `write_attribute`. -- cgit v1.2.3