Skip to content

Commit

Permalink
Make the example work (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujihisa authored Jul 3, 2024
1 parent 05b5235 commit 5dbf4e6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions guides/rails-integration/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ 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

# Schedule a refresh every second:
Async do
while true
sleep 1
replace!
update!
end
end
end
Expand Down Expand Up @@ -77,4 +73,4 @@ Rails.application.routes.draw do
# Live WebSocket:
match "clock/live", via: [:get, :connect]
end
```
```

0 comments on commit 5dbf4e6

Please sign in to comment.