0
votes

I have migrated from Paperclip to Carrierwave, and using Carrierwave_direct to upload images directly to S3.

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

So, in my schema, I don't have column profile_picture but profile_picture_file_name in my users table.

This creates problem when I am trying to create the @uploader instance variable

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

This throws an error, when a user is trying to upload the Profile Image, undefined method `success_action_redirect=' for nil:NilClass

1

1 Answers

0
votes

I guess this could fix it:

@uploader = @user.profile_picture