语法错误,active_record/attribute_methods/read.rb 中出现意外的 kEND
我正在新环境中设置一个工作应用程序,运行“捆绑安装”后,我尝试启动一个应用程序。 我收到以下错误:
ActionView::Template::Error (compile error
D:/Dev_apps/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.1.0.rc5/lib/active_record/attribute_methods/read.rb:85: syntax error, unexpected kEND
D:/Dev_apps/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.1.0.rc5/lib/active_record/attribute_methods/read.rb:87: syntax error, unexpected $end, expecting kEND):
6: <nav class="round">
7:
8: <ul>
9: <% if can? :browse_backend, current_user %>
10: <li><%= link_to "Админка", admin_root_path %></li>
11: <% end %>
12:
app/models/user.rb:60:in `has_role?'
app/models/ability.rb:14:in `initialize'
app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___239100443_122539296'
app/views/layouts/application.html.erb:16:in `_app_views_layouts_application_html_erb__144136837_122749020'
我不明白的是,这种情况怎么会发生在宝石中。
I'm setting up a working application on a new environment, and after running 'bundle install' I try to launch an application.
And I get a following error:
ActionView::Template::Error (compile error
D:/Dev_apps/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.1.0.rc5/lib/active_record/attribute_methods/read.rb:85: syntax error, unexpected kEND
D:/Dev_apps/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.1.0.rc5/lib/active_record/attribute_methods/read.rb:87: syntax error, unexpected $end, expecting kEND):
6: <nav class="round">
7:
8: <ul>
9: <% if can? :browse_backend, current_user %>
10: <li><%= link_to "Админка", admin_root_path %></li>
11: <% end %>
12:
app/models/user.rb:60:in `has_role?'
app/models/ability.rb:14:in `initialize'
app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___239100443_122539296'
app/views/layouts/application.html.erb:16:in `_app_views_layouts_application_html_erb__144136837_122749020'
What I can't understand is how can that happen in a gem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我将应用程序升级到rails 3.1时,我遇到了这个错误,我可以通过安装更新版本的mysql2 gem(我安装了0.3.7)来修复它。
I got this error when I upgraded my app to rails 3.1 and I was able to fix it by installing a more recent version of the mysql2 gem (I installed 0.3.7).
问题出在您的代码中,但由于 gem 使用您的代码来发挥其魔力,因此错误似乎来自 gem。
检查 user.rb 文件的第 60 行。那里可能存在语法错误。
The problem is in your code but since the gems use your code to do their magic it seems like the error comes from the gem.
Check your user.rb file at line 60. You might have a syntax error around there.