Add ~Don~ draper to decorate models in your application.
Icons/chart bar
Used 13 times
Created by
J Jason Charnes


Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/V1bsq4"
Template Source

Review the code before running this template on your machine.

run "spring stop"
gem "draper"
run "bundle install"
generate "draper:install"

if yes?("Would you like to generate decorators for your existing models?")
  Dir.glob(Rails.root.join("app/models/*.rb")).each { |file| require file }
  models = ApplicationRecord.send(:subclasses).map(&:name)
  models.each { |model| generate(:decorator, model) }

Sign up or Login to leave a comment.