为什么我在haml中出现此错误:语法错误,意外的keyword_ensure,期望$ end

时间:2012-01-12 20:29:24

标签: ruby-on-rails-3 ruby-on-rails-3.1 haml

有人可以解释为什么我会收到此错误:

app/views/students/registrations/new.html.haml:28: syntax error, unexpected keyword_ensure, expecting $end

Extracted source (around line #28):

25: = render :partial => "devise/shared/links"

以下是表格:

%h2 Sign up
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
  = devise_error_messages!
  %div
    = f.label :email
    %br/
    = f.email_field :email
  %div
    = f.label :password
    %br/
    = f.password_field :password
  %div
    = f.label :password_confirmation
    %br/
    = f.password_field :password_confirmation

  %p
    = f.label 'country', 'Country'
      %span
        (displayed in your articles / comments)
    = f.select :country_id, @countries
  %div= f.submit "Sign up"
= render :partial => "devise/shared/links"

1 个答案:

答案 0 :(得分:0)

这是因为您在以下行的标签内嵌套:

= f.label 'country', 'Country'
  %span
    (displayed in your articles / comments)

尝试将其更改为

= f.label 'country', 'Country'
%span (displayed in your articles / comments)

并以不同的方式造型。