Skip to content

Commit c8a30b2

Browse files
committed
feat: broadcast replace appointments with a lazy turbo frame
1 parent 3792eb6 commit c8a30b2

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

app/models/appointment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Appointment < ApplicationRecord
66
after_save_commit -> {
77
broadcast_replace_to(
88
"appointments_list",
9-
partial: "appointments/appointment",
9+
partial: "appointments/load_row",
1010
locals: { appointment: self }
1111
)
1212
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= turbo_frame_tag(appointment, src: row_appointment_path(appointment)) %>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= render "appointment", appointment: %>

config/routes.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
Rails.application.routes.draw do
22
resource :session
33
resources :passwords, param: :token
4-
resources :appointments, only: [ :index, :edit, :update ]
4+
resources :appointments, only: [ :index, :edit, :update ] do
5+
member do
6+
get :row
7+
end
8+
end
59
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
610

711
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.

0 commit comments

Comments
 (0)