class Project < ActiveRecord::Base
has_many :tasks
end
class Task < ActiveRecord:Base
belongs_to :project
end
## 查找某一个项目下的未完成任务, 按时间逆序排序
@project = Project.find(param[:id])
@task = @project.tasks.find_by_complete(false, order: "created_at DESC")
于2015-03-20