Carrierwave: Argument Error Nil location provided. Can't build URI for an image_tag using carrier wave Ruby on Rails

You have two options.

1) Render image tag only if there is an image to be shown:

 <% if @restaurant.image_url %>
    <%= image_tag @restaurant.image_url %>
 <% end %>

2) Provide a default value for image_url field:

 <%= image_tag @restaurant.image_url || default_image %>

It's better to do it in a model/presenter:

class Image < ApplicationModel

  def image_url
    super || default_image
  end
end

Or with attribute API:

class Image < ApplicationModel
  attribute :image_url, default: default_image
end