تحديث الاستطلاعات القديمة

مواصلة النقاش من ملاحظات إصدار Discourse 2.4.0.beta8:

رائع جدًا رؤية المخططات الدائرية! أعتقد أنه لا يمكن تغيير استطلاع رأي قديم إلى تنسيق المخطط الدائري، مثلًا عن طريق إدراج chartType=pie خفيةً في النص المُدرج؟ (لم أتمكن من جعله يستجيب لهذا التغيير، حتى بعد إعادة صياغة المنشور). كنت أحاول تحديث بعض الاستطلاعات القديمة التي ستستفيد من هذا العرض. شكرًا لك!

You need to do it on the rails console:

p = Poll.last
p.chart_type = 'pie'
p.save

Just to add to the Solution:

In my case my site usually has the poll in the first post of the Topic, so a quick way of getting to it on the rails console is this:

myPost = Topic.find_by(id: number-from-topic-url).posts.first.id
myPoll = Poll.find_by(post_id: myPost)

or if you really want to go crazy on one line (scroll right!):

myPoll = Poll.find_by(post_id: Topic.find_by(id: number-from-topic-url).posts.first.id)

Then in this case, of course:

myPoll.chart_type = 'pie'
myPoll.save