关于Rails,Haml和Forms的问题

时间:2011-01-12 01:11:17

标签: ruby-on-rails haml

  .section
  .title
    Subscription

  .body
    = form_tag(:action => subscribe_url, :method => :post)
      = @plans.each do |p|
        %tr= p[:blurb]
        %tr= p[:price]
      .spacer
      = submit_tag( 'Subscribe', :class => 'button ok' )

    %p
    %br
    Note: If you wish to cancel your subscription, please
    -# link_to  "contact Customer Support", "http://support.jobfully.com"

我们看到的错误是: /home/mei/Jobfully/app/views/subscriptions/list.html.haml:21:语法错误,意外的keyword_ensure,期待$ end

提取的来源(第21行):

18:%br 19:注意:如果您想取消订阅,请 20: - #link_to“联系客户支持”,“http://support.jobfully.com”

我们非常感谢有关我们在这里做错的任何建议enter code here。谢谢!

2 个答案:

答案 0 :(得分:3)

我不知道它是否直接相关,但form_tag应该是

- form_tag(:action => subscribe_url, :method => :post) do

并且你的每个循环应该是

- @plans.each do |p|

在我上面发布的haml中,有很多,我称之为'古怪'。通过这种方式,我的意思是你有完全为空的标签,例如.section%p,因为它们下面没有任何嵌套。我会尝试尽可能多地切断并逐个重新开始重建haml文件。

答案 1 :(得分:0)

试试这个

%br
%p
  Note: If you wish to cancel your subscription, please
  = link_to  "contact Customer Support", "http://support.jobfully.com"