aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 96094a285f..52cfea79ff 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,17 @@
+* Add `:default` option to `belongs_to`.
+
+ Use it to specify that an association should be initialized with a particular
+ record before validation. For example:
+
+ # Before
+ belongs_to :account
+ before_validation -> { self.account ||= Current.account }
+
+ # After
+ belongs_to :account, default: -> { Current.account }
+
+ *George Claghorn*
+
* Deprecate `Migrator.schema_migrations_table_name`.
*Ryuta Kamizono*