针对与 Rails 2.0.2 和 Ruby 1.8.7 一起使用的附件插件/gem 的建议

发布于 2024-11-07 16:44:29 字数 2482 浏览 3 评论 0原文

我正在尝试在我的 RoR 应用程序中附加文件。我将 Rails 2.0.2 和 Ruby 1.8.7 用于项目特定目的。我使用的是 Ubuntu 10.04 操作系统。

我已经尝试了两个插件(paperclip 和attachment_fu),但到目前为止我还没有成功地使用它们。我面临兼容性问题,因为我使用的配置现在几乎没有使用。

请参阅这些 URL,以便更好地了解我当前面临的问题:

  1. 使用 Ruby 1.8.7 的 Rails 2 的带有回形针 2.3.8 gem 的未定义方法“has_attached_file”

  2. https://stackoverflow.com/questions/6000588/issues-with-attachment-fu-plugin-in-rails-2

另外,我正在寻求有关插件或 gem 的建议,我可以使用它们根据上述配置在我的 Rails 应用程序中附加文件。

编辑

我还想补充一点,我尝试了回形针 2.1.2 gem,但它似乎没有通过 IRB 检测到。我不知道这些信息会产生多大的影响,但我想补充一点,我也在使用 RVM 并随身携带另一个 ruby​​ 1.9.2。

虽然回形针 gem 已安装并显示在我的 ruby​​ gems 列表中,但我想知道为什么当我通过 require 'paperclip' 执行时会得到 null( '[]' ) IRB。

mohnish@mohnish-desktop:~/UP/pocs_tried_for_use/post_with_image$ gem list

*** LOCAL GEMS ***

aasm (2.2.0, 2.1.1)
action_profiler (1.0.0)
actionmailer (2.3.5, 2.0.2)
actionpack (2.3.5, 2.0.2)
activerecord (2.3.5, 2.0.2)
activeresource (2.3.5, 2.0.2)
activesupport (3.0.0, 2.3.5, 2.0.2)
acts_as_reportable (1.1.1)
aws-s3 (0.6.2)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
color (1.4.1)
contacts (1.2.4)
daemons (1.1.0)
fastercsv (1.5.3)
fastthread (1.0.7)
ferret (0.11.6)
gdata (1.1.1)
gem_plugin (0.2.3)
gettext (2.1.0)
hoe (2.6.2)
hpricot (0.8.3, 0.8.2)
httpclient (2.1.5.2)
image_science (1.2.1)
json (1.4.6)
json_pure (1.4.6)
locale (2.0.5)
log4r (1.1.8)
macaddr (1.0.0)
mechanize (1.0.0)
memcache-client (1.8.5)
mime-types (1.16)
mocha (0.9.8)
mongrel (1.1.5)
mysql (2.8.1)
nokogiri (1.4.3.1)
paperclip (2.1.2)
passenger (2.2.4)
pdf-writer (1.1.8)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
rack (1.0.1)
railroad (0.5.0)
rails (2.0.2)
rake (0.8.7)
RedCloth (3.0.3)
rfacebook (0.9.8, 0.9.0)
rmagick (2.9.1)
ruby-activeldap (0.8.3.1)
ruby-net-ldap (0.0.4)
ruby-openid (2.1.8, 2.0.2)
rubyforge (2.0.4)
rubygems-update (1.3.7)
ruport (1.6.3)
scrubyt (0.4.06)
tinyurl (1.0.0)
transaction-simple (1.4.0)
uuid (2.3.1)
xml-simple (1.0.12)
mohnish@mohnish-desktop:~/pocs_tried_for_use/post_with_image$ ruby script/console
Loading development environment (Rails 2.0.2)
ruby-1.8.7-p334 :001 > require 'paperclip'
 => [] 
ruby-1.8.7-p334 :002 > 

I am trying to attach files in my RoR app. I am using Rails 2.0.2 and Ruby 1.8.7 for project specific purposes. I am using Ubuntu 10.04 OS.

I have tried out two plugins (paperclip and attachment_fu) but I have no luck so far in getting things working with them. I am facing compatibility issues as the configuration I am using is pretty much not used these days.

See these URLs in order to better understand the issues that I am currently facing:

  1. Undefined method `has_attached_file' with paperclip 2.3.8 gem for Rails 2 using Ruby 1.8.7

  2. https://stackoverflow.com/questions/6000588/issues-with-attachment-fu-plugin-in-rails-2

Also, I am seeking suggestions for plugins or gems which I can use to attach files in my Rails app based on the above configuration.

Edit

I also would like to add I tried out paperclip 2.1.2 gem but it doesn't seem to get detected through IRB. I don't know how much of a difference this information will make, but I would like to add that I am also making use of RVM and having another ruby 1.9.2 with me.

Although paperclip gem is installed and shows up in my ruby gems list, I wonder why I get a null( '[]' ) when I do a require 'paperclip' through IRB.

mohnish@mohnish-desktop:~/UP/pocs_tried_for_use/post_with_image$ gem list

*** LOCAL GEMS ***

aasm (2.2.0, 2.1.1)
action_profiler (1.0.0)
actionmailer (2.3.5, 2.0.2)
actionpack (2.3.5, 2.0.2)
activerecord (2.3.5, 2.0.2)
activeresource (2.3.5, 2.0.2)
activesupport (3.0.0, 2.3.5, 2.0.2)
acts_as_reportable (1.1.1)
aws-s3 (0.6.2)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
color (1.4.1)
contacts (1.2.4)
daemons (1.1.0)
fastercsv (1.5.3)
fastthread (1.0.7)
ferret (0.11.6)
gdata (1.1.1)
gem_plugin (0.2.3)
gettext (2.1.0)
hoe (2.6.2)
hpricot (0.8.3, 0.8.2)
httpclient (2.1.5.2)
image_science (1.2.1)
json (1.4.6)
json_pure (1.4.6)
locale (2.0.5)
log4r (1.1.8)
macaddr (1.0.0)
mechanize (1.0.0)
memcache-client (1.8.5)
mime-types (1.16)
mocha (0.9.8)
mongrel (1.1.5)
mysql (2.8.1)
nokogiri (1.4.3.1)
paperclip (2.1.2)
passenger (2.2.4)
pdf-writer (1.1.8)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
rack (1.0.1)
railroad (0.5.0)
rails (2.0.2)
rake (0.8.7)
RedCloth (3.0.3)
rfacebook (0.9.8, 0.9.0)
rmagick (2.9.1)
ruby-activeldap (0.8.3.1)
ruby-net-ldap (0.0.4)
ruby-openid (2.1.8, 2.0.2)
rubyforge (2.0.4)
rubygems-update (1.3.7)
ruport (1.6.3)
scrubyt (0.4.06)
tinyurl (1.0.0)
transaction-simple (1.4.0)
uuid (2.3.1)
xml-simple (1.0.12)
mohnish@mohnish-desktop:~/pocs_tried_for_use/post_with_image$ ruby script/console
Loading development environment (Rails 2.0.2)
ruby-1.8.7-p334 :001 > require 'paperclip'
 => [] 
ruby-1.8.7-p334 :002 > 

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

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

发布评论

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

评论(1

半葬歌 2024-11-14 16:44:29

如果您使用的是较旧版本的 Rails,您可能会面临严重的安全漏洞,因此如果您可以升级,您确实应该升级,即使只是升级到 2.0.x 系列中的另一个版本。

话虽如此,您始终可以安装那个时代的 paperclip 版本。据我所知,较新的版本仅支持 2.3 或更高版本。

github 上托管的任何项目都将具有完整的版本历史记录,以便您可以将项目回退到适合您的特定修订版。 git bisect 工具非常适合处理此类事情。

If you're using a significantly older version of Rails you may be exposing yourself to serious security vulnerabilities, so if you can upgrade, you really should, even if it's just to another point release in the 2.0.x series.

That being said, you could always install a version of paperclip that's from that era. Newer versions only support 2.3 or better as far as I know.

Any project that's hosted on github will have a full version history so you can rewind the project to a particular revision that works for you. The git bisect tool is great for handling this sort of thing.

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