古いアンケートの更新

Discourse 2.4.0.beta8 リリースノートからの議論を続けます。

円グラフが表示されるのは素晴らしいですね!もしかして、挿入されたテキストにこっそり chartType=pie を追加するなどして、既存のアンケートを円グラフ形式に変更することはできないのでしょうか?(Post Rebake しても、その変更には反応しませんでした。)そのような表示形式で恩恵を受けられる古いアンケートを更新しようとしていました。ありがとうございます!

「いいね!」 3

You need to do it on the rails console:

p = Poll.last
p.chart_type = 'pie'
p.save
「いいね!」 11

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
「いいね!」 5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.