From 0e9e1044e39c4de40638ff7c0841152a549c1767 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Tue, 7 Apr 2020 00:33:09 +0300 Subject: [PATCH] Fix maps --- app/uploaders/image_uploader.rb | 2 +- app/views/maps/_form.html.erb | 4 ++-- app/views/maps/show.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index bf01bc3..10758c6 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -6,7 +6,7 @@ class ImageUploader < CarrierWave::Uploader::Base storage :file def store_dir - "images" + File.join("local", "maps") end def filename diff --git a/app/views/maps/_form.html.erb b/app/views/maps/_form.html.erb index 953e4f9..ca9aaa2 100644 --- a/app/views/maps/_form.html.erb +++ b/app/views/maps/_form.html.erb @@ -16,8 +16,8 @@
<%= f.label :picture %>
- <% if @map.picture.length > 0 %> - <%= image_tag @map.picture %>
+ <% if @map.picture&.file&.exists? %> + <%= image_tag @map.picture.url %>
<% end %> <%= f.file_field :picture %>
diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 9032693..c85706e 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -5,7 +5,7 @@ <% if @map.picture.length > 0 %>
- <%= image_tag @map.picture %> + <%= image_tag @map.picture.url %>
<% end %>