提交 bc06ee37 编写于 作者: A Aaron Patterson

we should not allow invalid objects to be constructed

上级 a9087ab2
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册