我试图在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: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'
来自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'
来自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'
来自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
发送'
来自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'
来自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'
来自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'
来自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'
来自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'
来自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_paperclip_bridge插件安装两个AS插件。但是,错误并没有消失。
有人可以解释为什么会发生错误吗?!
无论如何,我真的希望得到任何解决方案或解决方法。
谢谢, 健一
答案 0 :(得分:0)
自我回复。
我意识到最新的ActiveScaffold实现不需要as_paperclip_bridge。 (它包括桥梁)
请确保安装ImageMagick和RMagick gem以将PaperClip用于图像文件。或者,你也可以认为'as_paperclip_bridge应该在那里'
谢谢你, 健一