2013-12-17 133 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