rails newbie need help with form. I have a movie application. In the index I list all the movies and in addition i have ratings check boxes for (R, PG, PG-13, G) basically when you check a box and submit, the page should refresh with movies with the chosen rating. So if you check R,PG; only movies rated R and PG should be displayed. At the moment, when i check any box and submit the query seems to work but no movies are returned. When i checked the log this is what i get.
Parameters: {"utf8"=>"✓", "ratings"=>{"R"=>"on"}} Movie Load (0.1ms) SELECT "movies".* FROM "movies" WHERE (rating LIKE'--- - R - ''on'' ') here's my movie.rb model code. def self.checkBoxTest(ratings) if ratings where('rating LIKE?', ratings) else scoped end end note: using haml for views: index.html.haml %h1 All Movies = form_tag movies_path, :method => :get do Include: - @all_ratings.each do |rating| ="#{rating}" = check_box_tag "ratings[#{rating}]", params[:ratings] = submit_tag 'Refresh', :name => nil %table#movies def index @movies = Movie.order(sort_column) @movies = Movie.checkBoxTest(params[:ratings]) @all_ratings = Movie.find_all_rating end here's my controller index method -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.