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