Skip to content

Carrierwave not uploading the file. #154

@nsantiago2719

Description

@nsantiago2719

I have been using carrierwave-mongoid for my projects. But this is the first time that I encounter this problem. I'm trying to upload a Avatar for the user. I have mounted the uploader, configure the options, and followed the steps every time I use carrierwave. But after uploading the avatar field turns out to old every image upload. Here's a code in my controller

def create
  @user = User.new(data)
  if @user.save
    if params[:user][:avatar].present?
      @user.avatar = params[:user][:avatar]
      @user.save
    end
  end
end

I checked the value of params[:user][:avatar] and it returns me the file. But when I checked @user.avatar's value it returns me this path /uploads/user/avatar/56d00fddc001ff0bd5616990/_old_ . Oh and by the way I checked the path but there is nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions