Skip to content

Instantly share code, notes, and snippets.

@them0nk
Created March 23, 2012 06:45
Show Gist options
  • Save them0nk/2167767 to your computer and use it in GitHub Desktop.
Save them0nk/2167767 to your computer and use it in GitHub Desktop.
Rails Model
#To get a column from a Model
Movie.all # Returns all row from the table Movies
Movie.select(:title).map { |m| m.title } # Returns array of title from the Model movie
Movie.select(:title).map(&:title) # Returns array of title from the Model movie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment