我刚刚从rails 3更新到rails4。所有内容都在本地运行,但是部署在heroku上,出现以下错误:
ActionView::Template::Error (uninitialized constant Moped::BSON):
3: %nav.navbar-collapse
4: %ul.nav
5: %li
6: - if user_signed_in?
7: = link_to 'Logout', destroy_user_session_path, :method=>'delete'
8: - else
9: = link_to 'Login', new_user_session_path
app/views/layouts/_navigation.html.haml:6:in `_app_views_layouts__navigation_html_haml___1118031947301940708_70104067139880'
app/views/layouts/application.html.haml:18:in `_app_views_layouts_application_html_haml__1093647294459268715_70104069850820'
当我访问current_user时,其他haml文件中也会发生相同的错误-如果current_user ...
以下为我工作:
添加到Gemfile:
gem "bson"
gem "moped", github: "mongoid/moped"
捆绑安装
添加到application.rb:
require "bson"
require "moped"
Moped::BSON = BSON
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句