Turbo Broadcast Extraction
Since Phlex views are objects, they can be integrated with Turbo Broadcast in a more intuitaive way. Consider this User model that updates an account dashboard with the lastest stats.
class User < ApplicationRecord
after_commit do
Components::Account::Stats.new(account).broadcast_replace
end
end
Before Phlex, you might have had to :
class User < ApplicationRecord
after_commit do
broadcast_replace_to "account_stats_#{account.id}", target: dom_id(self) }
end
end
🔓 Unlock content
Purchase this course to unlock this video, source code, and content.
Purchase video course for $379 $329