ruby on rails - undefined method 'url' for "filename.png":String` -
again in trouble. everythings works fine, reebot , got error undefined method 'url' "1503393906_pointer.png":string
. error occurs when enter in property
(view & edit).
part of _form.html.erb
<% if !@property.slider1.url.nil? %> <%= content_tag :p, file.basename(@property.slider1.path)%> <label><%= form.check_box :remove_slider1 %> remove slier #1 </label> <% end %>
part of property.rb (model)
class property < applicationrecord mount_uploader :slider1, slideruploader end
part of slider_uploader.rb
class slideruploader < carrierwave::uploader::base storage :file def store_dir "cdn" end def extension_whitelist %w(jpg jpeg gif png avi mp4) end def content_type_whitelist ['image/jpeg', 'image/gif', 'image/png', 'image/svg+xml', 'image/bmp', 'video/x-msvideo'] end def filename "#{time.now.to_i}_#{original_filename}" if original_filename end end
wiki
Comments
Post a Comment