提交 b30a23f5 编写于 作者: R Ryuta Kamizono

`:through`, `:source`, and `:source_type` are valid for through association

上级 a2a0321b
......@@ -75,7 +75,6 @@ def middle_reflection(join_model)
def middle_options(join_model)
middle_options = {}
middle_options[:class_name] = "#{lhs_model.name}::#{join_model.name}"
middle_options[:source] = join_model.left_reflection.name
if options.key? :foreign_key
middle_options[:foreign_key] = options[:foreign_key]
end
......
......@@ -7,7 +7,9 @@ def self.macro
end
def self.valid_options(options)
super + [:primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type, :index_errors]
valid = super + [:primary_key, :dependent, :as, :inverse_of, :counter_cache, :join_table, :foreign_type, :index_errors]
valid += [:through, :source, :source_type] if options[:through]
valid
end
def self.valid_dependent_options
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册