gpt4 book ai didi

ruby-on-rails - HAML - 错误意外的 keyword_ensure,期望输入结束

转载 作者:行者123 更新时间:2023-12-04 05:56:55 26 4
gpt4 key购买 nike

语法 haml 有什么问题?我用了2个空格。显示错误:/home/user/myapp/bds/app/views/polls/_voting_form.html.haml:14: syntax error, unexpected keyword_ensure, expecting end-of-input

= form_tag votes_path, method: :post, remote: true, id: 'voting_form'
= hidden_field_tag 'poll[id]', @poll.id

= render partial: 'polls/poll_item', collection: @poll.poll_items, as: :item

%p
%b Итого голосов: = @poll.votes_count

- if current_user.voted_for?(@poll)
%p Вы уже голосовали!
- else
= submit_tag 'Голосовать', class: 'btn-bg'

最佳答案

我看到两个错误:

  • 您在 form_tag 行中缺少 do
  • 第二个错误不是阻塞,而是对于 votes_count:要么使用字符串插值,要么在多行上写入(现在它只会将其打印为字符串)

恕我直言,最简单的解决方案是编写

%b Итого голосов: #{@poll.votes_count}

关于ruby-on-rails - HAML - 错误意外的 keyword_ensure,期望输入结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31679325/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com