title: Rails 5 CarrierWave error "nil is not a valid asset source"
body: <p>Im getting an error "nil is not a valid asset source" when I got to the show page in my app. I'm not sure If it the image is just not saving or how I am attempting to display it is wrong.</p>
  
  <p>Uploader folder:</p>
  
  <pre><code>class AvatarUploader &lt; CarrierWave::Uploader::Base
  
  storage :file
  
   def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
   end
  </code></pre>
  
  <p>Profile Model:</p>
  
  <pre><code>class Profile &lt; ApplicationRecord
  
    has_many :albums
  
    mount_uploader :image, AvatarUploader
  end
  </code></pre>
  
  <p>Schema:</p>
  
  <pre><code> create_table "profiles", force: :cascade do |t|
    t.string   "name"
    t.date     "born"
    t.string   "bio"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string   "image"
   end
  </code></pre>
  
  <p>The Field from the View where the images gets uploaded:</p>
  
  <pre><code>class ProfilesController &lt; ApplicationController
   before_action :set_profile, only: [:show, :edit, :update, :destroy]
  
   def index
    @search = Profile.search(params[:q])
    @profiles = @search.result(distinct: true)
   end
  
   def show
   end
  
   def new
    @profile = Profile.new
   end
  
   def edit
   end
  
   def create
    @profile = Profile.new(profile_params)
  
    respond_to do |format|
    if @profile.save format.html { redirect_to @profile, notice: 'Profile was  successfully       created.' }
      format.json { render :show, status: :created, location: @profile }
     else
       format.html { render :new }
       format.json { render json: @profile.errors, status:  :unprocessable_entity }
      end
    end
  end
  
  def update
   respond_to do |format|
    if @profile.update(profile_params)
      format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }
      format.json { render :show, status: :ok, location: @profile }
     else
      format.html { render :edit }
      format.json { render json: @profile.errors, status: :unprocessable_entity }
      end
     end
    end
  
   def destroy
    @profile.destroy
   respond_to do |format|
    format.html { redirect_to profile_url, notice: 'Profile was successfully destroyed.' }
    format.json { head :no_content }
    end
  end
  
  private
  
  def set_profile
    @profile = Profile.find(params[:id])
  end
  
   def profile_params
    params.require(:profile).permit(:name, :bio, :born)
   end    
  end
  </code></pre>
  
  <p>The Form View That I fill out and add the Picture and Info:</p>
  
  <pre><code>&lt;%= form_for @profile, :html =&gt; {:multipart =&gt; true} do |f| %&gt;
  &lt;% if @profile.errors.any? %&gt;
  &lt;div id="error_explanation"&gt;
    &lt;h2&gt;&lt;%= pluralize(@profile.errors.count, "error") %&gt; prohibited this profile from being saved:&lt;/h2&gt;
    &lt;ul&gt;
    &lt;% @profile.errors.full_messages.each do |message| %&gt;
      &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
    &lt;% end %&gt;
    &lt;/ul&gt;
   &lt;/div&gt;
   &lt;% end %&gt;
  
  &lt;div class="field"&gt;
   &lt;%= f.file_field :image %&gt;&lt;br&gt;
  &lt;/div&gt;
  
  &lt;div class="field"&gt;
   &lt;%= f.label :name %&gt;&lt;br&gt;
   &lt;%= f.text_field :name %&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class="field"&gt;
  &lt;%= f.label :bio %&gt;&lt;br&gt;
  &lt;%= f.text_area :bio %&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class="field"&gt;
  &lt;%= f.label :born %&gt;&lt;br&gt;
  &lt;%= f.date_select :born %&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class="actions"&gt;
  &lt;%= f.submit %&gt;
  </code></pre>
  
  <p></p>
  
     
  
  <p>And the Show view where I get the error:</p>
  
  <pre><code>&lt;p&gt;
  &lt;%= image_tag @profile.image_url %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;Name:&lt;/strong&gt;
  &lt;%= @profile.name %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;Bio:&lt;/strong&gt;
  &lt;%= @profile.bio %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;Born:&lt;/strong&gt;
  &lt;%= @profile.born %&gt;
  &lt;/p&gt;
  
  &lt;%= link_to 'Edit', edit_profile_path(@profile) %&gt; |
  &lt;%= link_to 'Back', profiles_path %&gt;
  </code></pre>
  
  <p>I submit the image and get the error message with the line from the show view above highlighted.</p>
  
  <p>"Showing /home/ubuntu/workspace/music-db/app/views/profiles/show.html.erb where line #5 raised:</p>
  
  <p>nil is not a valid asset source"</p>
  
  <p>From reading other similar issues. It us maybe that the image is not saving correctly. As if there was image save it would not be nil. But really I am just not sure. Am only trying out this gem for the first time.</p>
  
  <p>Any and all help is greatly appreciated.</p>