您好我已经从rails 4.0.0升级到Rails 4.1.0
现在我收到了这个错误:
删除时
.active
它有效...但为什么?我该如何解决这个问题?
course.rb
self.inheritance_column = :_type_disabled
has_and_belongs_to_many :clients, :join_table => :clients_courses # TODO c
has_many :memberships, :dependent => :destroy
has_many :users, :through => :memberships
has_many :lessons,
-> {order "lessons.sort ASC, lessons.start_date"},
:dependent => :destroy,
:foreign_key => :course_object_id
scope :active, where(:active => true)
scope :inactive, where(:active => false)
答案 0 :(得分:2)
scope :active, -> { where(:active => true) }
scope :inactive, -> { where(:active => false) }
答案 1 :(得分:2)
course.rb
中的You should provide lambda to the scope:
scope :active, -> { where active: true }
scope :inactive, -> { where active: false }