Ruby on rails HAML:语法错误,意外的tIDENTIFIER,应为关键字\u end

Ruby on rails HAML:语法错误,意外的tIDENTIFIER,应为关键字\u end,ruby-on-rails,haml,Ruby On Rails,Haml,如何将此代码转换为HAML <h4 class="media-heading"><%= link_to comment.user.name, comment.user.profile_url, target: '_blank' %> says <small class="text-muted">[at <%= comment.created_at.strftime('%-d %B %Y, %H:%M:%S') %>]</s

如何将此代码转换为HAML

<h4 class="media-heading"><%= link_to comment.user.name, comment.user.profile_url, target: '_blank' %> says
          <small class="text-muted">[at <%= comment.created_at.strftime('%-d %B %Y, %H:%M:%S') %>]</small></h4>

如果你把它放在同一条线上,哈默怎么知道悬挂的“说”是什么

HAML中的
=
表示一行Ruby。您不能在同一行上随意抛出单词,然后期望Ruby理解什么是Ruby,什么是普通的旧字符串

%h4.media-heading 
  = link_to message.user.name, message.user.profile_url, target: '_blank'
  says
  %small.text-muted [at '#{= message.created_at.strftime('%-d %B %Y, %H:%M:%S')}']

你应该检查一下缩进。您可以在@maximus处验证hamlツ 缩进与该错误无关
%h4.media-heading 
  = link_to message.user.name, message.user.profile_url, target: '_blank'
  says
  %small.text-muted [at '#{= message.created_at.strftime('%-d %B %Y, %H:%M:%S')}']