diff options
author | Yves Senn <yves.senn@gmail.com> | 2016-09-03 13:34:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-03 13:34:58 +0200 |
commit | bd19d09b31f64cba364fa16962ad47879ef24f34 (patch) | |
tree | a75b3e45235f56de1248faadf3b8ea2b6705a8a6 /activerecord/lib/active_record/associations/association.rb | |
parent | 57b95c39869e20ef4db9850b9328e6ea52ca7377 (diff) | |
parent | dd5cba852fe3a2503bce66530d1aa14ed2032e2c (diff) | |
download | rails-bd19d09b31f64cba364fa16962ad47879ef24f34.tar.gz rails-bd19d09b31f64cba364fa16962ad47879ef24f34.tar.bz2 rails-bd19d09b31f64cba364fa16962ad47879ef24f34.zip |
Merge pull request #26381 from kamipo/extract_duplicated_create_for_association
Extract duplicated `create` and `create!` definition for association
Diffstat (limited to 'activerecord/lib/active_record/associations/association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 8328286805..f506614591 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -173,6 +173,14 @@ module ActiveRecord set_inverse_instance(record) end + def create(attributes = {}, &block) + _create_record(attributes, &block) + end + + def create!(attributes = {}, &block) + _create_record(attributes, true, &block) + end + private def find_target? |