# החלף עוגה לסרגל בסקר הפעיל

**URL:** https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712
**Category:** Support
**Tags:** polls, rails-console
**Created:** [6 באפריל,‏ 2024,‏ 6:13pm UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712 "2024-04-06T18:13:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [6 באפריל,‏ 2024,‏ 6:13pm UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/1 "2024-04-06T18:13:13Z")

</div>

Hi all,

is it possible to change from pie to bar in an active poll? I [created a poll](https://www.sidemount-forum.com/t/umfrage-helles-oder-dunkles-farbschema/7068) and then edited the post and changed from pie to bar, as I do not see the participants in the pie version of the poll, although they should be public. Now I see “bar” in the post code, but it is still a pie poll. Maybe because it is active and cannot be changed anymore? Questions over questions. 😉

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [6 באפריל,‏ 2024,‏ 7:33pm UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/2 "2024-04-06T19:33:56Z")

</div>

Hello 👋

I found this topic.

> [@Updating old Polls](https://meta.discourse.org/t/updating-old-polls/137551):
>
> Continuing the discussion from [Discourse 2.4.0.beta8 Release Notes](https://meta.discourse.org/t/discourse-2-4-0-beta8-release-notes/135183/2): Fantastic to see pie charts! I guess it’s not possible to retro-actively change a Poll to pie chart format e.g. by sneakily inserting chartType=pie into the inserted text? (I couldn’t get it to respond to that change, even on Post Rebake). I was attempting to update some old Polls that would benefit from that presentation. Thanks!

I’ve tested it now and works fine. 🙂

> [@Updating old Polls](https://meta.discourse.org/t/updating-old-polls/137551/3):
>
> 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

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [13 באפריל,‏ 2024,‏ 10:22pm UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/3 "2024-04-13T22:22:20Z")

</div>

Thank you @Don, but I have a little understanding problem. 😉 I only would like to edit this one single poll. What would I type into the rail console?

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [13 באפריל,‏ 2024,‏ 10:37pm UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/5 "2024-04-13T22:37:48Z")

</div>

What Don showed you should be correct.

```ruby
myPoll = Poll.find_by(post_id: Topic.find_by(id: 7068).posts.first.id)
myPoll.chart_type = 'pie'
myPoll.save

```

You want to find the Topic data based on the topic ID (7068).  
You retrieve the poll data based on the first post ID.  
You change the chart type and save.

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [14 באפריל,‏ 2024,‏ 9:56am UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/6 "2024-04-14T09:56:17Z")

</div>

@Arkshine @Don thank you for making this clear to me and sorry, sometimes I’m kinda dumb when it comes to programming languages I do not really understand. 😉

And most important, [it worked](https://www.sidemount-forum.com/t/umfrage-helles-oder-dunkles-farbschema/7068), I have the bars and also see who voted for what option! 🙂 Thank you!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [14 במאי,‏ 2024,‏ 9:57am UTC](https://meta.discourse.org/t/change-pie-to-bar-in-active-poll/302712/7 "2024-05-14T09:57:13Z")

</div>

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