aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-10-19 15:56:18 +0100
committerJon Leighton <j@jonathanleighton.com>2012-10-19 15:56:18 +0100
commit0096f53b25e68c3fc79429253f816fff4a4ee596 (patch)
treefc417451449721484ace89a60c896ec3361c0989 /activerecord/CHANGELOG.md
parent45d585e82759e02d6fa1032c835ff290b1cd2bf2 (diff)
downloadrails-0096f53b25e68c3fc79429253f816fff4a4ee596.tar.gz
rails-0096f53b25e68c3fc79429253f816fff4a4ee596.tar.bz2
rails-0096f53b25e68c3fc79429253f816fff4a4ee596.zip
nodoc the first_or_create methods and document alternatives
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md14
1 files changed, 11 insertions, 3 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 1edcd7cfc8..ed5d0eebdf 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -24,9 +24,17 @@
Which obviously does not affect the scoping of queries within
callbacks.
- The `find_or_create_by` version also reads better, frankly. But note
- that it does not allow attributes to be specified for the `create`
- that are not included in the `find_by`.
+ The `find_or_create_by` version also reads better, frankly.
+
+ If you need to add extra attributes during create, you can do one of:
+
+ User.create_with(active: true).find_or_create_by(first_name: 'Jon')
+ User.find_or_create_by(first_name: 'Jon') { |u| u.active = true }
+
+ The `first_or_create` family of methods have been nodoc'ed in favour
+ of this API. They may be deprecated in the future but their
+ implementation is very small and it's probably not worth putting users
+ through lots of annoying deprecation warnings.
*Jon Leighton*