迁移到 4.2 并在 has_many 中出现错误

migrating to 4.2 and getting error in has_many

我有:

class Location < ActiveRecord::Base
  has_many :mobile_menus, class_name: "Menu", ~> { where is_instore_enabled: true } 

但我收到错误消息:

location.rb:52: syntax error, unexpected '>' (SyntaxError)

对于那个运算符到哪里。我究竟做错了什么?是 class_name 吗?

我想你想使用 stabby lambda (->)。 不是 ~>.