README.markdown in better_ar-0.0.4 vs README.markdown in better_ar-0.0.5
- old
+ new
@@ -13,16 +13,16 @@
gem install better_ar
## Usage
-Now a single hash can be passed to ActiveRecord::Base.all that contains not only the where values but also other scopes like 'limit' and 'order'
+Now a single hash can be passed to ActiveRecord::Base.all that contains not only the where values but also other scopes like 'limit' and 'order' and also implicit joins
- User.all(:age => 10, :limit! => 5, :offset! => 10, :order! => :name)
+ User.all(:age => 10, :limit! => 5, :offset! => 10, :order! => :name, :records => {:name => 'test'})
is the same as
- User.where(:age => 10).limit(5).offset(10).order(:name)
+ User.joins(:records).where(:age => 10, :records => {: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.
This library completely removes the old .all, .first and .count class methods from ActiveRecord::Base. As these methods were just delegated to ActiveRecord::Base.scoped they can still be called.