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 %>