Level 2 challenge 1 syntax

Aaron's Avatar

Aaron

21 Apr, 2012 03:19 AM

In the following line of code whats does 'desc' mean?

scope :recent, order('created_at desc').limit(4)

I can see that 'created_at' referes to the 'created at' column but just not sure what the 'desc' part is achieving.

  1. Support Staff 2 Posted by Code School Support on 21 Apr, 2012 08:15 AM

    Code School Support's Avatar

    Hi Aaron,

    desc or DESC is a common abbreviation used for the word descending as opposed to ascending order. It's used here to order by the most recent created_at date.

    Hope that helps,
    Olivier

  2. Code School Support closed this discussion on 21 Apr, 2012 08:15 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac