1
= form_tag movies_path, :id => 'ratings_form', :method => :get do

  Include:

  - @all_ratings.each do |rating|
    = rating
    - is_checked = (!@selected_ratings.nil? && @selected_ratings.include?(rating))
    = check_box_tag "ratings[#{rating}]", is_checked, is_checked, {:id => "ratings_#{rating}"}
    = submit_tag 'Refresh', :id => 'ratings_submit'
4

1 回答 1

1

参考:-check_box_tag

改变

check_box_tag "ratings[#{rating}]", is_checked, is_checked, {:id => "ratings_#{rating}"}

check_box_tag "ratings[#{rating}]", is_checked, true, {:id => "ratings_#{rating}"}
于 2013-02-08T12:27:15.600 回答