Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the example work #10

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```
```
Loading