gpt4 book ai didi

ruby-on-rails - 用于 Rails 的 HAML 表单

转载 作者:数据小太阳 更新时间:2023-10-29 07:10:25 26 4
gpt4 key购买 nike

我目前正在尝试将 ERB 布局转换为 HAML。

这是我不断收到的错误:

index.html.haml:18: syntax error, unexpected ')'
));}\n #{_hamlout.format_...

这是 HAML 页面:

.row-fluid
.span6
%h2 Todo List

.span6
%h2{:style => "text-align:right;"} <script>document.write(today)</script>

%hr.divider

.row-fluid
.span6
%h2.small_head New Task

= render :partial => 'layouts/form_errors', :locals => {:object => @list}

.form
= form_for :list, :url => {:controller => 'lists', :action => 'create'} do |f|
= label_tag :list_name, "Title", :class => 'header_label'

我也试过这个作为变体:

= form_for(:list, :url => {:controller => 'lists', :action => 'create'}) do |f|
= label_tag(:list_name, "Title", :class => 'header_label')

既不工作又生成相同的错误消息,非常感谢帮助。

最佳答案

您需要缩进do block 中的代码。这应该有效:

= form_for :list, :url => {:controller => 'lists', :action => 'create'} do |f|
= label_tag :list_name, "Title", :class => 'header_label'

关于ruby-on-rails - 用于 Rails 的 HAML 表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16430336/

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