Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add get_ratings class method and save to @all_ratings

  • Loading branch information...
commit 108cf9e16e7c49eb92f5752ef9d08bf2c3af5fae 1 parent 6552aef
Marc Kuo authored
Showing with 5 additions and 1 deletion.
  1. +2 −1  app/controllers/movies_controller.rb
  2. +3 −0  app/models/movie.rb
3  app/controllers/movies_controller.rb
View
@@ -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"
3  app/models/movie.rb
View
@@ -1,2 +1,5 @@
class Movie < ActiveRecord::Base
+ def self.get_ratings
+ Movie.all.collect{|x| x.rating}.uniq
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.