使用paperclipdropbox gem存储上传内容

时间:2012-07-05 02:06:28

标签: ruby-on-rails file-upload gem paperclip dropbox

我有一个Rails应用程序需要存储作业应用程序的简历。在本地,附件可以使用Paperclip插件正常工作。我想使用paperclipdropbox gem将它们存储在生产中。我做了以下事情:

1)在github

上的文件后面设置回形针

2)运行安装dropbox gem的命令,paperclipdropbox

gem install dropbox

3)根据https://github.com/dripster82/paperclipdropbox#readme设置paperclipdropbox 我的paperclipdropbox.yml文件看起来像那样


development:
  dropbox_key: email_for_dropbox_account
  dropbox_secret: password_for_dropboxaccount
production:
  dropbox_key: email_for_dropbox_account
  dropbox_secret: password_for_dropboxaccount

运行后

rake paperclipdropbox:authorize 

我收到以下错误:


C:\Sites\appname>rake paperclipdropbox:authorize  --trace
rake aborted!
Don't know how to build task 'paperclipdropbox:authorize'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task_
manager.rb:49:in `[]'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:115:in `invoke_task'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `each'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block in top_level'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:88:in `top_level'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:66:in `block in run'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:63:in `run'
C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in
 `'
C:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `load'
C:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `'

遗憾的是,我没有在网上找到太多文档。什么可能导致问题?你还有其他免费的存储空间吗?

2 个答案:

答案 0 :(得分:1)

我认为你可能已经安装了宝石,但没有在你的Gemfile中定义它们。确保您的Gemfile中有paperclipdropboxpaperclip-dropbox gem。

gem 'paperclip'
gem 'dropbox'
gem 'paperclipdropbox'

然后运行bundle install,并尝试再次运行该rake任务。这是因为默认情况下,Bundler会隔离并使只有Gemfile中的宝石对您的Rails应用程序可见。

答案 1 :(得分:0)

您必须在Dropbox中创建项目。 Here你有链接。

使用后rake paperclipdropbox:authorize