Browse files

add get_ratings class method and save to @all_ratings

  • Loading branch information...
1 parent 6552aef commit 108cf9e16e7c49eb92f5752ef9d08bf2c3af5fae @mck- committed Mar 9, 2012
Showing with 5 additions and 1 deletion.
  1. +2 −1 app/controllers/movies_controller.rb
  2. +3 −0 app/models/movie.rb
View
3 app/controllers/movies_controller.rb
@@ -7,7 +7,8 @@ def show
end
def index
-# raise params.inspect
+ # raise params.inspect
+ @all_ratings = Movie.get_ratings
if params[:sort] == "title"
@movies = Movie.find(:all, :order => :title)
elsif params[:sort] == "date"
View
3 app/models/movie.rb
@@ -1,2 +1,5 @@
class Movie < ActiveRecord::Base
+ def self.get_ratings
+ Movie.all.collect{|x| x.rating}.uniq
+ end
end

0 comments on commit 108cf9e

Please sign in to comment.