Rails 3.1 中的 ActiveAdmin 资产问题

发布于 2024-12-31 21:20:00 字数 794 浏览 1 评论 0原文

我一直在尝试让 ActiveAdmin 与我的 Rails 3.1.1 应用程序一起使用。它主要工作,直到我查看网络开发人员控制台并注意到图像没有被加载:

GET http://localhost:3000/images/active_admin/datepicker/datepicker-nipple.png 404 (Not Found)

我遇到了一些有类似问题的人,指出网址应该是用“资产”而不是图像生成的。我尝试了我发现的更新 'sass-rails' gem 的建议,但我没有运气。

我尝试使用 Rails 3.1.1 从头开始​​启动一个全新的应用程序(原始应用程序是 Rails 3.1.0,不确定升级是否会产生影响,然后重新开始),并首先执行了建议的修复,现在每个图像都加载良好。我尝试将 Gemfile 的类似部分复制回来,但它似乎并没有解决我实际应用程序的问题。这是我的 Gemfile 中相关行周围的区域:

gem 'sass-rails',   '~> 3.1.4'
gem 'meta_search',    '>= 1.1.0.pre'
gem 'activeadmin'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

有什么提示吗?

I've been trying to get ActiveAdmin to work with my Rails 3.1.1 application. It mostly works until I was looking at the web developers console and noticed images weren't being loaded:

GET http://localhost:3000/images/active_admin/datepicker/datepicker-nipple.png 404 (Not Found)

I came across some people with similar problems, pointing out the url should have been generated with 'assets' not images. I tried the recommendations I found to update the 'sass-rails' gem but I had no luck.

I tried to start a brand new application from scratch with Rails 3.1.1 (the original app was Rails 3.1.0 not sure if the upgrade made the difference then a fresh start) and did the recommended fixes first and now every image loads fine. I tried to copy the similar part of the Gemfile back but it didn't seem to fix my actually application's problem. This is the area around the related lines in my Gemfile:

gem 'sass-rails',   '~> 3.1.4'
gem 'meta_search',    '>= 1.1.0.pre'
gem 'activeadmin'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

Any tips?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

千柳 2025-01-07 21:20:01

通过完全卸载 gems 并删除我在该项目中与 RVM 一起使用的 gemset 并在新版本的 Rails (2.3) 中重做所有内容来修复此问题。在 github 上遇到类似的问题后,我相信这不是 ActiveAdmin 新版本中的问题,但这是我的解决方案。

Fixed this by completely uninstalling gems and deleting the gemset I was using with RVM for this project and redoing everything in a new version of rails (2.3). Following a similar issue on github leads me to believe this isn't an issue in a new release of ActiveAdmin but this was my solution.

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