class ActiveRecord::Base# normal find_each does not use given order but uses id ascdef self.find_each_with_order(options={})raise"offset is not yet supported"ifoptions[:offset]page=1limit=options[:limit]||1000loopdooffset=(page-1)*limitbatch=find(:all,options.merge(:limit=>limit,:offset=>offset))page+=1batch.each{|x|yieldx}breakifbatch.size<limitendendend

If you implement your own formbuilder, the options passed are available as
@options inside your formbuilder. If you want those configuration
options passed to all builders in the fields_for
sections, use the following code in your form builder:

Usage:

The key thing to note from post is that class_inheritable_accessor
copies the value from the parent class at inherit time. So, if you are
setting a default value of an array and doing something like the following
you might end up with unintended results: