README.markdown in better_ar-0.0.6 vs README.markdown in better_ar-0.0.7
- old
+ new
@@ -21,9 +21,17 @@
is the same as
User.joins(:records).where(:age => 10, :records => {:name => 'test'}).limit(5).offset(10).order(:name)
+It also works on association collections:
+
+ User.first.records.all(:level => 2, :limit! => 5, :offset! => 10, :order! => :name, :reports => {:name => 'test'})
+
+This would be the same as:
+
+ User.first.records.joins(:reports).where(:level => 2, :reports => {:name => 'test'}).limit(5).offset(10).order(:name)
+
While this may seem less concise the advantage is being able to dynamically construct the query with a single hash in code.
### Legacy
If the params contain :condition it will fall back to the legacy method.