Model.find :all, :conditions=>{ :name_like => 'John' }
Model.find :all, :conditions=>{ :name_contains => 'John' }
ex:
order = Item.find_with_conditions( :first ) do
name 'like', 'Item%'
end
User.find :first, :conditions => {:name => 'Tom Ward'} # note that this already works in rails
Task.find :all, :conditions => {:priority_more_than => 50} # this one doesn't
svn: svn://rubyforge.org//var/svn/popdog/slice_and_dice/tags/REL-0.1
Schools.where 'name includes' => 'George' People.awhere 'id in' => [34,35,36]
Very addictive!
home page http://code.google.com/p/ruby-roger-useful-functions/wiki/SqlAsEnglish
Person.query.first_name_like('%name%').last_name_eq('lastname').join('address').city_eq('Sydney')
Helper methods for directly building and combining conditions.
Sql.and(
["foo=?", bar],
Sql.in("id", [1, 3, 5])
)
# => ["(foo=?) AND (id IN (?,?,?))", bar, 1, 3, 5]
svn: http://sql-helper.rubyforge.org/svn/trunk/plugins/sql_helper
Allows your db to be hit only when you actually run a query (i.e.
a = Item.find :all a[0] # query is executed right here, instead of when created, above.
website: http://m.onkey.org/2007/12/12/query-objects-and-delayed-execution
Allows us to specify custom sql and a column mapping to your find with included associations. On it’s own, ActiveRecord will produce SQL to load multiple associations recursively, but the generated SQL is usually not optimal. This plugin allows you to use customized SQL and map the column results to attributes of your (potentially recursive) eager-loaded associations.
home page:
http://kellogg-assoc.com/articles/2006/11/05/eager-finder-sql
rdoc:
http://kellogg-assoc.com/rdoc/eager_finder_sql/index.html
svn:
svn://rubyforge.org/var/svn/eagerfindersql
Allows a query which already preloads (eager loads_ some information from associated objects (so you can create just one AR object instead of many)
ex:
Customer.find_by_ormql("SELECT user.nick, postal_code.province.name, name WHERE user.nick='Josh'")
into
"SELECT a.`nick` AS `user.nick`, d.`name` AS `postal_code.province.name`, b.`name` FROM `customers` b LEFT JOIN `postal_codes` c ON c.`id`=b.`postal_code_id` LEFT JOIN `provinces` d ON d.`id`=c.`province_id`, `users` a WHERE a.`id`=b.`user_id` AND (a.`nick`='Josh')"
homepage: http://rubyforge.org/projects/ormql/
An extension to the database adapter, validations, and helpers to support database columns with constrained values using informtion in the database schema (MySql enum column type). Currently MySql is supported, future releases will support other databases using column constraints.
home page:
http://enum-column.rubyforge.org/
svn:
svn://rubyforge.org/var/svn/enum-column/plugins/enum-column
Lets you interact with the command-line gpg interface. Assumes you have GnuPG installed, and your keys already generated and ready!
svn:
svn://ahgsoftware.com/gnupg/trunk
svn: http://julik.textdriven.com/svn/tools/rails_plugins/simple_search
SodaSearch enhances your existing model objects with full text indexing. It supports stopwords, term stemming, and stores the index right in your RDBMS. An optional “subsource” metadata tag allows you to store arbitrary information along with the index data, enabling reindexing or deletion of arbitrary subsets of the index for a particular item.
Note there is a comparison page of some of these http://blog.evanweaver.com/articles/2008/03/17/rails-search-benchmarks/