0

我是 Ruby 新手,下面是我面临的问题。在我的 index.html 中,我有这段代码用于复选框

= form_tag movies_path, :id=>"ratings_form", :method => :get do
  Include: 
  - @all_ratings.each do |rating|
    = rating
    = check_box_tag "ratings[#{rating}]", :id => "ratings_#{rating}"
    = submit_tag 'Refresh', :id => "ratings_submit"

在我的控制器中,我有

def index
#@movies = Movie.all
@sort = params[:sort]
@movies = Movie.order(@sort)
@all_ratings = Movie.all_ratings
debugger
end

在调试点,我期待那些被选中的复选框的值,但只有 nil

(rdb:53) puts params[:ratings]

nil

整个参数

(rdb:53) puts params

{"action"=>"index", "controller"=>"movies"}  

nil
4

0 回答 0