aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-16 18:25:50 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-16 13:43:53 -0800
commit52c47556b7cf55549f97f3cfd5f69b2563198eac (patch)
treec43cfba16b8e7c0944d42bbc4224b9a178ec7a7f /activerecord/lib/active_record/associations.rb
parent8f88a2841682d95c7bcce7ee76c156ec24bf82d8 (diff)
downloadrails-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.rb6
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|