In the Rails Engine application you need to connect gem draper . After completing all the instructions on the docks, namely:
After installing the gem and executing the rails generate decorator command, I create the decorator:
class OrderDecorator < Draper::Decorator delegate_all delegate :hide_part_number, :expiration_date, to: :credit_card, prefix: true decorates_association :credit_card decorates_association :shipping_address decorates_association :billing_address decorates_association :order_items end When starting the application, it crashes 
My engine_name.gemspec.rb
s.add_dependency "rails", "~> 5.0.0", ">= 5.0.0.1" s.add_dependency 'aasm', '~> 4.10', '>= 4.10.1' s.add_dependency 'wicked', '~> 1.3' s.add_dependency 'haml', '~> 4.0', '>= 4.0.7' s.add_dependency 'bootstrap-sass', '~> 3.3', '>= 3.3.6' s.add_dependency 'draper', '~> 2.1' s.add_dependency 'activesupport-decorators', '~> 1.0' s.add_development_dependency 'pg' On one of the sites I found advice on how to overcome this problem, but unfortunately did not help:
There I advise you to add to engine.rb
config.to_prepare do Dir.glob(Rails.root + 'app/decorators/**/*_decorator*.rb').each do |c| require_dependency(c) end end But that did not change anything.
draper. I have advised you to master the debugger at some point? .. - D-sideOrderDecorator, and theShoppingCart::OrderDecoratormodel does a mismatch, but you can say for sure only by checking this theory. - D-sideOrdermodel is not loaded, if it should be in theShoppingCartspace at all, or more precisely the wrong model is loaded. As far as I understand, just OrderDecorator is applied spontaneously only to the top-level model. - Mal Skrylev