我有一个用这样的HAML文件编写的表格
= form_tag "ratings_form", movies_path, :method => :get do
Include:
- @all_ratings.each do |rating|
= rating
= check_box_tag "ratings[#{rating}]", 'yes', @ratings.keys.include?(rating)
= submit_tag 'Refresh'
我想给每个表单和提交按钮一个特定的id
我检查了文档,发现给定的参数
form_tag或submit_tag 不包含 id 。
正确的答案是添加 :id => "id_u_want" 到任何标签,显然它会在我做的时候起作用
= form_tag movies_path, :id => "ratings_form" , :method => :get do
Include:
- @all_ratings.each do |rating|
= rating
= check_box_tag "ratings[#{rating}]", 'yes', @selected_ratings.keys.include?(rating)
= submit_tag 'Refresh' , :id => "ratings_submit"