2013-12-14 47 views
0

我有這段代碼:如何堆疊多個輔助方法?

@products = Product.order(id: :desc, :limit => 7) 

它返回以下錯誤:

Direction should be :asc or :desc 

它的工作,但是,如果我只設置限者之一。那麼添加多個幫手的正確方法是什麼?

回答

2

你可能想這樣的:

@products = Product.order(id: :desc).limit(7)