<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/polling-for-new-records-u7i4frczs" -->

---
title: Polling for New Records | daily.dev
description: A practical tutorial on implementing long polling for new records in a Rails app without WebSockets. Uses a Stimulus controller that periodically fetches new...
canonical: https://daily.dev/posts/polling-for-new-records-u7i4frczs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Polling for New Records | daily.dev
og:description: A practical tutorial on implementing long polling for new records in a Rails app without WebSockets. Uses a Stimulus controller that periodically fetches new...
og:url: https://daily.dev/posts/polling-for-new-records-u7i4frczs
og:image: https://api.daily.dev/og/posts/u7i4FRczs.png
og:image:alt: Polling for New Records
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Polling for New Records

**[RUBYLAND](https://daily.dev/sources/rubyla)** · 2 min read · 0 upvotes · 0 comments

## Summary

A practical tutorial on implementing long polling for new records in a Rails app without WebSockets. Uses a Stimulus controller that periodically fetches new comments via a dedicated poll endpoint, tracking the last seen record ID to only retrieve new entries. The approach uses Rails generators to scaffold a Comment model with rich text, a polls controller, and a Stimulus poller controller with configurable interval, inserting new HTML fragments into the DOM using insertAdjacentHTML.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.driftingruby.com/episodes/polling-for-new-records>

## Similar posts on daily.dev

- [Building a quiz with Stimulus](https://daily.dev/posts/building-a-quiz-with-stimulus-ice3bffmv) · RUBYLAND · 4 upvotes · 0 comments

---

Tags: [#ruby](https://daily.dev/tags/ruby), [#rails](https://daily.dev/tags/rails), [#hotwire](https://daily.dev/tags/hotwire)

[View this post on daily.dev](https://daily.dev/posts/polling-for-new-records-u7i4frczs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Polling for New Records","url":"https://daily.dev/posts/polling-for-new-records-u7i4frczs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/polling-for-new-records-u7i4frczs"},"datePublished":"2026-06-07T19:24:15.066Z","dateModified":"2026-06-07T19:24:36.061Z","description":"A practical tutorial on implementing long polling for new records in a Rails app without WebSockets. Uses a Stimulus controller that periodically fetches new...","image":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","thumbnailUrl":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","isAccessibleForFree":true,"articleSection":"RUBYLAND","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"RUBYLAND","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/rubyla","url":"https://daily.dev/sources/rubyla"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/polling-for-new-records-u7i4frczs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ruby,rails,hotwire","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"Polling for New Records"}]}
```

