paperclip-dropbox评估nil。[]错误

时间:2012-12-03 01:04:10

标签: ruby-on-rails paperclip dropbox-api

尝试使用paperclip-dropbox但没有太大成功。 这就是我所做的。

在我的Gemfile中:

gem 'paperclip'
gem "paperclip-dropbox"

在Dropbox上创建了一个应用,并按照以下说明操作:     https://github.com/janko-m/paperclip-dropbox

在我的dropbox.yml

development:
    app_key: APP_KEY
    app_secret: APP_SECRET
    access_token: ACCESS_TOKEN
    access_token_secret: ACCESS_TOKEN_SECRET
    user_id: USER_ID

production:
    app_key: APP_KEY
    app_secret: APP_SECRET
    access_token: ACCESS_TOKEN
    access_token_secret: ACCESS_TOKEN_SECRET
    user_id: USER_ID

在我的用户模型中:

has_attached_file :avatar, 
    :styles => {
      thumb: '100x100>',
      square: '200x200#',
      medium: '300x300>' }

在我看来:

<%= image_tag @user_profile.avatar.url(:square), :size => '100x100' %>

错误讯息:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]  

指向我的image_tag代码行。

请注意,使用本地文件系统,paperclip工作得很好。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

在您的用户型号中,请尝试删除尺寸背后的符号,例如“100x100&gt;”到'100x100','200x200#'到'200x200'

相关问题