Skip to content

Instantly share code, notes, and snippets.

@imteekay
Created October 14, 2015 12:56
Show Gist options
  • Save imteekay/4a116db5cfa8dd1c17eb to your computer and use it in GitHub Desktop.
Save imteekay/4a116db5cfa8dd1c17eb to your computer and use it in GitHub Desktop.
Post.all
=> [#<Post id: 1, title: "Database & Rails", text: "Lorem Ipsum...", created_at: "2015-10-13 20:00:00", author_id: 1>, #<Post id: 2, title: "Ruby on Rails: HTTP, MVC and Routes", text: "Lorem Ipsum2...", created_at: "2015-10-13 21:00:00", author_id: 1>]
Post.order("created_at DESC")
=> [#<Post id: 2, title: "Ruby on Rails: HTTP, MVC and Routes", text: "Lorem Ipsum2...", created_at: "2015-10-13 20:00:00", author_id: 1>, #<Post id: 1, title: "Database & Rails", text: "Lorem Ipsum...", created_at: "2015-10-13 21:00:00", author_id: 1>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment