HAML: form_tag dilemma (indentation?)

后端 未结 1 763
不思量自难忘°
不思量自难忘° 2021-02-18 21:14

I\'m making \"user settings form\", and stuck with HAML:

= form_tag(\'/\')
  - [1,2,3].each do |i|
    =  check_box_tag \"accept#{i}\"
  = submit_tag


        
相关标签:
1条回答
  • 2021-02-18 21:25

    You should be passing a block to form_tag. I think you want:

    Rails 2.x:

    - form_tag('/') do
      - [1, 2, 3].each do |i|
        = check_box_tag "accept#{i}"
      = submit_tag
    

    Rails 3+:

    = form_tag('/') do
      - [1, 2, 3].each do |i|
        = check_box_tag "accept#{i}"
      = submit_tag
    
    0 讨论(0)
提交回复
热议问题