语法错误,active_record/attribute_methods/read.rb 中出现意外的 kEND

发布于 2024-12-01 09:07:11 字数 973 浏览 1 评论 0原文

我正在新环境中设置一个工作应用程序,运行“捆绑安装”后,我尝试启动一个应用程序。 我收到以下错误:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伤感在游骋 2024-12-08 09:07:11

当我将应用程序升级到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).

单身情人 2024-12-08 09:07:11

问题出在您的代码中,但由于 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文