0
我想重用我定義的範圍,但它返回一個數組。Rails 4鏈接範圍
scope :currents, -> { (where('started_at < NOW()') | where('started_at' => nil)) & where('ended_at > NOW()') & where('published_at < NOW()') }
def self.findNextAuctions()
currents.order(ended_at: :asc).limit(3)
end
當我調用該函數findNextAuctions我得到這個錯誤:
1) Error:
AuctionTest#test_should_fint_next_auctions:
NoMethodError: undefined method `order' for #<Array:0x007fae5d6e3878>
app/models/auction.rb:13:in `findNextAuctions'
test/models/auction_test.rb:14:in `block in <class:AuctionTest>'