diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-16 18:25:50 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-16 13:43:53 -0800 |
commit | 52c47556b7cf55549f97f3cfd5f69b2563198eac (patch) | |
tree | c43cfba16b8e7c0944d42bbc4224b9a178ec7a7f /activerecord/lib/active_record/associations.rb | |
parent | 8f88a2841682d95c7bcce7ee76c156ec24bf82d8 (diff) | |
download | rails-52c47556b7cf55549f97f3cfd5f69b2563198eac.tar.gz rails-52c47556b7cf55549f97f3cfd5f69b2563198eac.tar.bz2 rails-52c47556b7cf55549f97f3cfd5f69b2563198eac.zip |
Add create_association! for belongs_to
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index a03d1bbb06..70c8e75e20 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1533,10 +1533,10 @@ module ActiveRecord def association_constructor_methods(reflection) constructors = { - "build_#{reflection.name}" => "build", - "create_#{reflection.name}" => "create" + "build_#{reflection.name}" => "build", + "create_#{reflection.name}" => "create", + "create_#{reflection.name}!" => "create!" } - constructors["create_#{reflection.name}!"] = "create!" if reflection.macro == :has_one constructors.each do |name, proxy_name| redefine_method(name) do |*params| |