I have two models, each with their own Carrierwave uploaders:
class User < ActiveRecord::Base
mount_uploader :avatar, AvatarUploader
end
and:
class Bookshelf < ActiveRecord::Base
mount_uploader :image, ImageUploader
end
I want the user's avatar to be the latest bookshelf image he's uploaded. I try to achieve this like so:
class BookcasesController < ApplicationController
def create
@bookcase = current_user.bookcases.build(params[:bookcase])
if @bookcase.save
current_user.avatar = @bookcase.image
current_user.avatar.recreate_versions!
end
end
end
Unfortunately, this has no effect on the avatar at all. How else might I achieve this?