Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add get_ratings class method and save to @all_ratings

  • Loading branch information...
commit 108cf9e16e7c49eb92f5752ef9d08bf2c3af5fae 1 parent 6552aef
Marc Kuo authored
3  app/controllers/movies_controller.rb
@@ -7,7 +7,8 @@ def show
7 7 end
8 8
9 9 def index
10   -# raise params.inspect
  10 + # raise params.inspect
  11 + @all_ratings = Movie.get_ratings
11 12 if params[:sort] == "title"
12 13 @movies = Movie.find(:all, :order => :title)
13 14 elsif params[:sort] == "date"
3  app/models/movie.rb
... ... @@ -1,2 +1,5 @@
1 1 class Movie < ActiveRecord::Base
  2 + def self.get_ratings
  3 + Movie.all.collect{|x| x.rating}.uniq
  4 + end
2 5 end

0 comments on commit 108cf9e

Please sign in to comment.
Something went wrong with that request. Please try again.