diff options
author | George Claghorn <george.claghorn@gmail.com> | 2017-03-17 10:29:19 -0400 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-03-17 15:29:19 +0100 |
commit | 73b86ac58b61b4c7b888962252a1a86dffb24081 (patch) | |
tree | ea34e055f17867f3811a874bdc51461b40fc417f /activerecord/test/migrations | |
parent | eadbc82c47fd157ed4f1eb4c4983ab0734023106 (diff) | |
download | rails-73b86ac58b61b4c7b888962252a1a86dffb24081.tar.gz rails-73b86ac58b61b4c7b888962252a1a86dffb24081.tar.bz2 rails-73b86ac58b61b4c7b888962252a1a86dffb24081.zip |
Add :default option to belongs_to (#28453)
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 }
Diffstat (limited to 'activerecord/test/migrations')
0 files changed, 0 insertions, 0 deletions