Skip to content

Instantly share code, notes, and snippets.

@kiero
Created June 5, 2012 03:06
Show Gist options
  • Select an option

  • Save kiero/2872331 to your computer and use it in GitHub Desktop.

Select an option

Save kiero/2872331 to your computer and use it in GitHub Desktop.
def index
years = Movie.select("strftime('%Y', release)").group("strftime('%Y', release)").count
grouped = {}
years.each do |k,v|
grouped[k] = Movie.where("strftime('%Y', release) = ?", k)
end
@years = grouped
end
Showing:
- @years.each do |k,v|
%li.nav-header= k
- v.each do |movie|
%li
%label.checkbox
%input{:type => "checkbox"}
%a{:href => "#"}= movie.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment