0

Rails noob 在这里,所以我不确定我做错了什么。

我们正在用 mini_magick 替换很多回形针功能。这似乎很简单,直到我意识到出于某种原因我们有一个名为 Image 的类这一事实正在把事情搞砸。

我在 MiniMagick 中重命名了 Image 类并解决了这个问题,但是我们还有一个名为 method_missing 的方法,它也在 MiniMagick 中。

将所有引用等重命名为 magick_method_missing,现在我收到以下错误。

undefined method `resize' for #<MiniMagick::ImageEditor:0x2b236a98c9f8>

(ImageEditor 是重命名的类)。

这是我第一次在我们的系统中处理插件。我所有其他的经验都非常简单,“gem install ...”哈哈。有谁知道我可能会错过什么?

现在,我将逐行查看代码,看看我是否遗漏了某个地方的引用。这是我唯一能想到的。

4

2 回答 2

0

Why would you rename classes and methods in 3rd party code?

And method_missing is called whenever a method is not found. If I remember right MiniMagick uses it for calls to the binary, renaming it wont work, it has to be named method_missing.

As far as using a plugin goes, you can use the gem. Its homepage is located here.

于 2011-11-23T16:28:31.837 回答
0

确保您已安装 imagemagick。我遇到了同样的错误

undefined method `resize' for #<MiniMagick::ImageEditor:0x2b236a98c9f8>

我注意到我的 Mac 上安装了 imagemagick,但版本较旧。我不得不卸载并重新安装。

我使用自制软件卸载旧版本并再次安装 imagemagick:

brew unlink imagemagick
brew install imagemagick
于 2015-06-20T21:12:10.810 回答