@tasks = Task.find(:all, :conditions => ['complete = ?', false])动态查询方法:
@tasks = Task.find(:first, :conditions => ['complete = ?', false], :order => 'created_at DESC')
@tasks = Taks.find_all_by_complete(false)注意第二个,直接把:order这个hash作为第二个参数传进去就可以了。
@tasks = Taks.find_by_complete(false, :order => 'created_at DESC')
没有评论:
发表评论