From ac8fd7dfb91eb0e554537e671eaf1615a1d19757 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 2 Jan 2005 13:31:00 +0000 Subject: Added dynamic attribute-based finders as a cleaner way of getting objects by simple queries without turning to SQL. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@307 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index f354430b68..eee602faf2 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,15 @@ *SVN* +* Added dynamic attribute-based finders as a cleaner way of getting objects by simple queries without turning to SQL. + They work by appending the name of an attribute to find_by_, so you get finders like Person.find_by_user_name, + Payment.find_by_transaction_id. So instead of writing Person.find_first(["user_name = ?", user_name]), you just do + Person.find_by_user_name(user_name). + + It's also possible to use multiple attributes in the same find by separating them with "_and_", so you get finders like + Person.find_by_user_name_and_password or even Payment.find_by_purchaser_and_state_and_country. So instead of writing + Person.find_first(["user_name = ? AND password = ?", user_name, password]), you just do + Person.find_by_user_name_and_password(user_name, password). + * Added that Base#find takes an optional options hash, including :conditions. Base#find_on_conditions deprecated in favor of #find with :conditions #407 [bitsweat] * Added a db2 adapter that only depends on the Ruby/DB2 bindings (http://raa.ruby-lang.org/project/ruby-db2/) #386 [Maik Schmidt] -- cgit v1.2.3