Skip to content

Commit

Permalink
Integration with Turbo::Broadcastable
Browse files Browse the repository at this point in the history
Overriding defaults for Turbo broadcast jobs allows one to get decorated
objects in model partials by default.

Resolves #910.
Requires #928.
  • Loading branch information
Alexander-Senko committed Sep 16, 2024
1 parent 93a9bc2 commit 28c134d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/draper/decoratable.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'draper/decoratable/equality'
require 'draper/compatibility/broadcastable'

module Draper
# Provides shortcuts to decorate objects directly, so you can do
Expand All @@ -15,7 +14,10 @@ module Decoratable
autoload :CollectionProxy, 'draper/decoratable/collection_proxy'

included do
prepend Draper::Compatibility::Broadcastable if defined? Turbo::Broadcastable
if defined? Turbo::Broadcastable
require_relative 'compatibility/broadcastable'
prepend Compatibility::Broadcastable
end
end

# Decorates the object using the inferred {#decorator_class}.
Expand Down

0 comments on commit 28c134d

Please sign in to comment.