Browse files

we should not allow invalid objects to be constructed

  • Loading branch information...
1 parent a9087ab commit bc06ee374b953a985e045370cbb260cda59b7130 @tenderlove tenderlove committed Jul 31, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 activerecord/lib/active_record/associations/builder/association.rb
View
3 activerecord/lib/active_record/associations/builder/association.rb
@@ -41,6 +41,8 @@ def initialize(model, name, scope, options)
@options = options
end
+ validate_options
+
if @scope && @scope.arity == 0
prev_scope = @scope
@scope = proc { instance_exec(&prev_scope) }
@@ -52,7 +54,6 @@ def mixin
end
def build
- validate_options
define_accessors
configure_dependency if options[:dependent]
reflection = ActiveRecord::Reflection.create(macro, name, scope, options, model)

0 comments on commit bc06ee3

Please sign in to comment.