您好,我一直在查看 Paperclip 后处理的所有各种教程,但不知何故我无法调用“Make”方法。
在这里查看第 36 行... http://pastie.org/private/epfgcxywhyh4wpmozypg
它正常上传,没有任何错误或警告,但我永远看不到 make 方法中的 puts 语句,它告诉我这没有被调用。
编辑
我可以毫无问题地在模型中运行它,我得到了 True,
def class_exists?(class_name)
klass = Paperclip.const_get(class_name)
return klass.is_a?(Class)
rescue NameError
return false
end
有什么想法吗?
最佳答案
两天前我遇到了同样的问题。这是我为使其工作所做的工作:
转到命令提示符并键入:“which convert”命令。这是 ImageMagick 命令,所以如果它说/usr/bin/convert 然后尝试添加
Paperclip.options[:command_path] = "/usr/bin"
在您的config/environments/development.rb 中。从你在那里得到的东西中删除/转换。
然后将文件的名称 file_contents.rb 更改为 paperclip_postprocess.rb 并将其放入目录:RAILS_ROOT/config/initializers/paperclip_postprocess.rb强>
您可以通过在模型中添加以下行来交叉检查您的附件是否正在处理:
before_post_process :before_post_process
after_post_process :after_post_process
def before_post_process
puts "===========Before processing attachment==========="
end
def after_post_process
puts "-----------After processign attachment------------"
end
看看here
至少对我有用。
关于ruby-on-rails - 为什么回形针后期处理不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5278028/