Sujal Paudel
Sujal Paudel

Reputation: 43

Carrierwave for image upload with ruby on rails

I am trying to upload image using carrierwave. Everything seems to be correct, but I am repeatedly getting an error stating:

Can't resolve image into URL: undefined method `to_model' for #<PortfolioUploader:0x007f35a5cad3c0>  
Did you mean?  to_xml  

Upvotes: 3

Views: 1508

Answers (1)

Hipjea
Hipjea

Reputation: 401

CarrierWave with Rails 5.2 ActiveStorage may have some issues. You could try to change your classic image_tag.

Assuming you're using something like this :

<%= image_tag(@user.image) %>

Change it to something like this, using .url

<%= image_tag(@user.image.url) %>

Upvotes: 13

Related Questions