Rails3 中的 as_paperclip_bridge 初始化错误

发布于 2024-11-19 11:25:39 字数 3058 浏览 3 评论 0原文

我试图在 Rails3.0.5 项目中在 as_paperclip_bridge 的帮助下使用 PaperClip 和 ActiveScaffold 。

但是,当我启动项目时,出现以下初始化错误。

=>启动 WEBrick => Rails 3.0.5 应用程序开始在 http://0.0.0.0:3000 上开发 =>使用 -d 调用来分离 => Ctrl-C 关闭服务器 退出 C:/Users/ken/Documents/NetBeansProjects/fcheck/vendor/plugins/as_paperclip_bridge/init.rb:10: ActiveScaffold:Module 的未定义方法 bridge' (NoMethodError) 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/plugin.rb:81 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initialized.rb:25:ininstance_exec' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initialized.rb:25:in run' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initialized.rb:50:inrun_initializers' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initialized.rb:49:in each' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initialized.rb:49:inrun_initializers' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in 初始化!' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:insend' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in method_missing' 来自 C:/Users/ken/Documents/NetBeansProjects/fcheck/config/environment.rb:7 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependency.rb:239:inrequire' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependency.rb:239:in require' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependency.rb:225:inload_dependency' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependency.rb:596:in new_constants_in' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependency.rb:225:inload_dependency' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependency.rb:239:in require' 来自 C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:3 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:ininstance_eval' 来自 C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in initialize' 来自 C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1:innew' 来自 C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1

as_paperclip_bridge\init.rb 中的代码尝试调用模块方法“ActiveScaffold.bridge”,但找不到。 尽管如此,相同的代码在rails2.3.8项目中运行没有错误。

我们可以看到版本 2 和版本 3 之间的 Rails 初始化代码有很大差异。

在 Rails 2.3.8 上,插件在“load_plugins”方法中加载,该方法在initializer.rb 中的“load_gems”方法之后调用。然而,rails3没有initializer.rb,加载过程似乎完全不同。

我还尝试删除 AS gem 并安装两个 AS 插件和 as_paperclip_bridge 插件。但是,错误并没有消失。

有人可以解释为什么会发生错误吗?

无论如何,我真的希望得到任何解决方案或解决方法。

谢谢, 兼一

I'm trying to use both of PaperClip and ActiveScaffold with help of as_paperclip_bridge in a rails3.0.5 project.

However, following initialization error is occurred when I launch the project.

=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Users/ken/Documents/NetBeansProjects/fcheck/vendor/plugins/as_paperclip_bridge/init.rb:10: undefined method bridge' for ActiveScaffold:Module (NoMethodError)
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/plugin.rb:81
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in
instance_exec'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in run'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in
run_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in each'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in
run_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in initialize!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in
send'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in method_missing'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config/environment.rb:7
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in
require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in
load_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in new_constants_in'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in
load_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:3
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in
instance_eval'
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in initialize'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1:in
new'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1

The code in as_paperclip_bridge\init.rb is attempting to call a module method 'ActiveScaffold.bridge' but it coun't be found.
Even though, same code is working without error in rails2.3.8 project.

We can see a big difference of rails initialization code between version 2 and 3.

On rails 2.3.8, plugins are loaded in 'load_plugins' method which is called after 'load_gems' method in initializer.rb. However, rails3 doesn't have initializer.rb and the loading process seems to be totally different.

I also have tried to remove AS gem and install both of AS plugin with as_paperclip_bridge plugin. But, the error haven't disappeared.

Could someone explain why the error is occurring?!

Anyway, I really hope to get any solution or workaround.

Thanks,
Kenichi

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

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

发布评论

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

评论(1

夜声 2024-11-26 11:25:39

自我回复。

我意识到最新的 ActiveScaffold 实现不需要 as_paperclip_bridge 。 (包括桥)

请确保安装 ImageMagick 和 RMagick gem 以使用 PaperClip 处理图像文件。或者,您可能还认为“as_paperclip_bridge 应该在那里”

谢谢,
兼一

Self reply.

I had realized that as_paperclip_bridge was not required for latest ActiveScaffold implementation. (It's including the bridge)

Please make sure to install ImageMagick and RMagick gem to use PaperClip for image files. Or, you may also think 'as_paperclip_bridge should be there'

Thank you,
Kenichi

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