当我使用“ rails s -e登台”在登台环境中运行代码时,出现错误:
ActionView::Template::Error (Unexpected character '`'):
[788647b2-7d6f-4d80-9820-ab477702e8af] 4: .panel_login
[788647b2-7d6f-4d80-9820-ab477702e8af] 5: = form_for @user_session, :html => {:class => 'login_form'} do |f|
[788647b2-7d6f-4d80-9820-ab477702e8af] 6: -# .head{:style => 'text-align:center;'}
[788647b2-7d6f-4d80-9820-ab477702e8af] 7: -# .margin_bottom_20= image_tag('silk_app_logo.png')
[788647b2-7d6f-4d80-9820-ab477702e8af] 8: -# .bold#page_title_login Silk Service Centre
[788647b2-7d6f-4d80-9820-ab477702e8af] 9:
[788647b2-7d6f-4d80-9820-ab477702e8af] 10: %fieldset
[788647b2-7d6f-4d80-9820-ab477702e8af]
[788647b2-7d6f-4d80-9820-ab477702e8af] app/views/user_sessions/new.html.haml:7:in `block in _app_views_user_sessions_new_html_haml___3840161814571174569_70257985310040'
[788647b2-7d6f-4d80-9820-ab477702e8af] app/views/user_sessions/new.html.haml:5:in `_app_views_user_sessions_new_html_haml___3840161814571174569_70257985310040'
如您所见,该字符不在我的代码中。该程序还可以在本地正常运行。任何帮助,将不胜感激。谢谢。
如果我删除该行,则同一行会出现相同的错误:
-------------------------------
Backtrace:
-------------------------------
app/views/user_sessions/new.html.haml:7:in `block in _app_views_user_se=
ssions_new_html_haml___3840161814571174569_70257985310040'
app/views/user_sessions/new.html.haml:5:in `_app_views_user_sessions_ne=
w_html_haml___3840161814571174569_70257985310040'
[4b6a81dd-71c7-4160-a431-bee39dc33475]
[4b6a81dd-71c7-4160-a431-bee39dc33475] ActionView::Template::Error (Unexpected character '`'):
[4b6a81dd-71c7-4160-a431-bee39dc33475] 4: .panel_login
[4b6a81dd-71c7-4160-a431-bee39dc33475] 5: = form_for @user_session, :html => {:class => 'login_form'} do |f|
[4b6a81dd-71c7-4160-a431-bee39dc33475] 6:
[4b6a81dd-71c7-4160-a431-bee39dc33475] 7: %fieldset
[4b6a81dd-71c7-4160-a431-bee39dc33475] 8: .login_label Email Address
[4b6a81dd-71c7-4160-a431-bee39dc33475] 9: .margin_bottom_20= email_field_tag 'user_session[email]', @user_session.email, :class => 'required form-control', :placeholder => 'Username', :id => 'login'
[4b6a81dd-71c7-4160-a431-bee39dc33475] 10: .login_label Password
[4b6a81dd-71c7-4160-a431-bee39dc33475]
[4b6a81dd-71c7-4160-a431-bee39dc33475] app/views/user_sessions/new.html.haml:7:in `block in _app_views_user_sessions_new_html_haml___3840161814571174569_70257985310040'
[4b6a81dd-71c7-4160-a431-bee39dc33475] app/views/user_sessions/new.html.haml:5:in `_app_views_user_sessions_new_html_haml___3840161814571174569_70257985310040'
答案 0 :(得分:1)
可能是控件的ASCII字符或类似的东西,您看不到它,但实际上它在您的代码文件中。请尝试删除该行并键入新行,看看它是否可以解决此问题。 / p>