7

スリムなテンプレートエンジンを試してみることにしましたが、奇妙なエラーが発生します。

ActionView::Template::Error (Unknown line indicator
  app/views/layouts/application.html.slim, Line 1
    <!DOCTYPE html>
    ^
):
  slim (1.1.1) lib/slim/parser.rb:448:in `syntax_error!'

すべてのページに表示されます。例えば:

Started GET "/" for 127.0.0.1 at 2012-03-21 09:47:49 +0400
Processing by AuthenticationsController#index as HTML
  Authentication Load (0.9ms)  SELECT "authentications".* FROM "authentications" 
  User Load (1.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 17 LIMIT 1
  CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 17 LIMIT 1
  Rendered authentications/index.html.slim within layouts/application (88.4ms)

私はgem 'slim-rails'自分のGemfileにあり、

views / authentications / index.html.slim:

table
  tr
    th User
    th Provider
    th Uid
  - for authentication in @authentications
    tr
      td = authentication.user_id
      td = authentication.provider
      td = authentication.uid
      td = link_to "Destroy", authentication, :confirm => 'Are you sure?', :method => :delete

views / layouts / application.html.slim:

doctype 5
html
  head
    title gttc
    = stylesheet_link_tag    "application", :media => "all"
    = javascript_include_tag "application"
    = csrf_meta_tags
  body
    p hi!
    = yield 

このエラーの原因がわかりません。スリムパーサーがすでに生成されたhtmlを解析しようとしているようです。しかし、なぜ?私の間違いはどこにありますか?

4

1 に答える 1

2

問題が解決しました。IDE(RubyMine)を再起動すると、何らかの理由でファイル.html.slimに古い.html.erbのテキストが含まれていることがわかりました。だから多分それはルビミンのある種のエラーだったのかもしれません。

于 2012-03-22T11:23:28.583 に答える