1

我正在尝试将 id 添加(:id => "ratings_form")到我form_tag的 in HAML,但找不到正确的位置

= form_tag movies_path, :method => :get do<br>
  Include:<br>
  - @movies.all_ratings.each do |rating|<br>
    = rating<br>
    = check_box_tag "ratings[#{rating}]"<br>
  = submit_tag 'Refresh'
4

3 回答 3

1

这适用于slim

= form_tag movies_path, :method => :get, id: "form_id" do

同样,我确信这不取决于标记语言。

于 2013-10-22T14:04:32.787 回答
0

在 rails 3.0.20 这个语法对我有用:

<% form_tag({:action => 'some_action'}, {:id => 'form_id'}) do %>
于 2017-01-21T03:42:43.357 回答
-2

试试看:

form_for(@post, url: post_path , html: { id: 'post_id' }) do |t|
于 2013-10-22T13:18:04.507 回答