# Обновление старых опросов

**URL:** <https://meta.discourse.org/t/updating-old-polls/137551>\
**Category:** Support\
**Tags:** polls, rails-console\
**Created:** [02.Январь.2020 12:48:17 UTC](https://meta.discourse.org/t/updating-old-polls/137551 "2020-01-02T12:48:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [03.Январь.2020 23:59:37 UTC](https://meta.discourse.org/t/updating-old-polls/137551/3 "2020-01-03T23:59:37Z")

</div>

Добавлю к решению:

В моём случае опрос обычно находится в первом посте темы, поэтому быстрый способ получить его через консоль Rails — это:

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

```

или, если вы действительно хотите сделать всё в одну строку (прокрутите вправо!):

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

```

Тогда в данном случае, конечно:

```plaintext
myPoll.chart_type = 'pie'
myPoll.save

```

---

_[View the full topic](https://meta.discourse.org/t/updating-old-polls/137551)._
