提交 1286ab6c 编写于 作者: R Ryuta Kamizono

Extract common valid options for association builder

上级 70d04a43
......@@ -18,7 +18,9 @@ class << self
end
self.extensions = []
VALID_OPTIONS = [:class_name, :anonymous_class, :foreign_key, :validate] # :nodoc:
VALID_OPTIONS = [
:class_name, :anonymous_class, :primary_key, :foreign_key, :dependent, :validate, :inverse_of
].freeze # :nodoc:
def self.build(model, name, scope, options, &block)
if model.dangerous_attribute_method?(name)
......
......@@ -7,7 +7,7 @@ def self.macro
end
def self.valid_options(options)
valid = super + [:primary_key, :dependent, :as, :inverse_of, :counter_cache, :join_table, :foreign_type, :index_errors]
valid = super + [:as, :counter_cache, :join_table, :foreign_type, :index_errors]
valid += [:through, :source, :source_type] if options[:through]
valid
end
......
......@@ -5,7 +5,7 @@
module ActiveRecord::Associations::Builder # :nodoc:
class SingularAssociation < Association #:nodoc:
def self.valid_options(options)
super + [:foreign_type, :dependent, :primary_key, :inverse_of, :required, :touch]
super + [:foreign_type, :required, :touch]
end
def self.define_accessors(model, reflection)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册