0
我有这样的数据库结构:
term.rb:ActiveRecord的选择与儿童谓词
class Term < ActiveRecord::Base
has_many :tasks, through: :students
...
def accepted_tasks_count
tasks.where(status: Task.statuses[:accepted]).count
end
task.rb:
class Task < ActiveRecord::Base
has_many :notes, through: :submissions
...
def notes_count
self.notes.count
end
我需要添加一些方法将返回接受任务没有笔记。 我该怎么做?
太谢谢你了。你救了我的命。 – Almanack