opoloo / lines-engine

Lines is a customizable blog framework for Rails. It aims at making publishing simple and beautiful.
http://lines.opoloo.com
GNU Lesser General Public License v3.0
216 stars 102 forks source link

Failed to upload painting: Article must exist #27

Closed yickting closed 5 years ago

yickting commented 6 years ago

Anyone encounter this issue as well while trying to upload images in blog post?

Would appreciate some help in fixing it.

Cheers.

BenoitDK commented 6 years ago

I am running into the same problem...

BenoitDK commented 6 years ago

This works :

![image alt text](image url)

yickting commented 6 years ago

Thank you for sharing the solution!

But i only see this: ![image alt text](image url)

Could you share again?

Cheers

BenoitDK commented 6 years ago

yes just put ![image alt text](image url) in your article with the url of your image

yickting commented 6 years ago

oh sorry, my vision was blurred just now, I thought I saw some failed screenshot upload error, will give it a try, thanks !!

ViTVetal commented 6 years ago

Same problem

hanhdt commented 6 years ago

This is happened when you guys are using Rails 5.*

Look at models/lines/picture.rb on belongs_to :article, touch: true. From Rails 5, belongs_to is required by default. In this case, you haven't article persisted yet. Therefore, you got the validation error message like above.

A workaround is updating codes by yourself. Change belongs_to :article, touch: true to belongs_to :article, touch: true, optional: true in the picture model.

See: https://github.com/opoloo/lines-engine/pull/21

thej commented 5 years ago

Fixed in latest release (1.2.6)