2
在Rails 3中,我一直在使用以下包含作用正常的作用域(在模块中定义)。Rails 4作用域包含嵌套关联散列
base.send :scope, :with_includes, { :include => {:questions => [:answers, :question_group, {:dependency => :dependency_conditions}]}}
此不再内轨道4的工作原理,所以我曾尝试将其转换为现在优选的方法拉姆达如下。
base.send :scope, :with_includes, -> { includes(:questions => [:answers, :question_group, {:dependency => :dependency_conditions}]) }
这只是抛出一个异常NoMethodError Exception: undefined method includes
谢谢;就是这样。 – bigtunacan