gpt4 book ai didi

ruby-on-rails - Slim 语法错误

转载 作者:行者123 更新时间:2023-12-04 12:48:58 25 4
gpt4 key购买 nike

我决定尝试超薄模板引擎,但出现奇怪的错误。

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 和

View /身份验证/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

View /布局/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。但为什么?我的错误在哪里?

最佳答案

问题解决了。当我重新启动我的 IDE (RubyMine) 时,我看到,出于某种原因,文件 .html.slim 包含来自旧 .html.erb 的文本。所以也许这只是 ruby​​mine 中的某种错误。

关于ruby-on-rails - Slim 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9799476/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com