From 83846623859ff02b26aa3f925347168475d886e8 Mon Sep 17 00:00:00 2001 From: ujihisa Date: Tue, 18 Jun 2024 19:37:51 -0700 Subject: [PATCH] Make the example work --- guides/rails-integration/readme.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/guides/rails-integration/readme.md b/guides/rails-integration/readme.md index 3cb15e5..c845144 100644 --- a/guides/rails-integration/readme.md +++ b/guides/rails-integration/readme.md @@ -7,11 +7,7 @@ This guide explains how to use the `live` gem with Ruby on Rails. Here is a simple implementation of a real-time clock tag: ```ruby -class ClockTag < Live::Tag - def initialize(name) - @name = name - end - +class ClockTag < Live::View def bind(page) super @@ -19,7 +15,7 @@ class ClockTag < Live::Tag Async do while true sleep 1 - replace! + update! end end end @@ -77,4 +73,4 @@ Rails.application.routes.draw do # Live WebSocket: match "clock/live", via: [:get, :connect] end -``` \ No newline at end of file +```