Don*_*llo 7 ruby-on-rails slim-lang
我决定尝试苗条的模板引擎,但我有奇怪的错误.
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!'
Run Code Online (Sandbox Code Playgroud)
它出现在所有页面上.例如:
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)
Run Code Online (Sandbox Code Playgroud)
我有gem 'slim-rails'我的Gemfile和
意见/认证/ 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
Run Code Online (Sandbox Code Playgroud)
景色/布局/ 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
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚这个错误的原因.似乎瘦的解析器试图解析已经生成的html.但为什么?我的错误在哪里?
问题解决了。当我重新启动 IDE (RubyMine) 时,我发现由于某种原因,文件 .html.slim 包含旧 .html.erb 中的文本。所以也许这只是 rubymine 中的某种错误。
| 归档时间: |
|
| 查看次数: |
4362 次 |
| 最近记录: |