Xeen
Xeen

Reputation: 7003

How do I stack multiple helper methods?

I have this bit of code:

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

Which returns the following error:

Direction should be :asc or :desc

It does work, however, if I set only one of those limiters. So what's the correct way of adding more than one helper?

Upvotes: 0

Views: 44

Answers (1)

Dylan Markow
Dylan Markow

Reputation: 124429

You probably want this:

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

Upvotes: 2

Related Questions