2013-12-17 112 views
0

我已經從Paperclip遷移到Carrierwave,並使用Carrierwave_direct將圖像直接上傳到S3。軌道從回形針遷移到carrierwave_direct

class User < ActiveRecord::Base 
    mount_uploader :profile_picture, ProfilePictureUploader, :mount_on => :profile_picture_file_name 

所以,在我的架構,我沒有在我的用戶表列profile_pictureprofile_picture_file_name

這就造成當我試圖創建@uploader實例變量

class ProfilePictureController < ApplicationController 
    def show 
    @user=current_user 
    @uploader = @user.profile_picture_file_name 
    @uploader.success_action_redirect = crop_url 
    end 

這將引發錯誤,當用戶嘗試上傳的檔案圖片, undefined method `success_action_redirect=' for nil:NilClass

回答

0

我想這可能問題修復它:

@uploader = @user.profile_picture