Sha256: 21631e4e93991ce63dfaed8ed280dfde6ddfca4d138560e4eef17cc805d7c1c5
Contents?: true
Size: 616 Bytes
Versions: 7
Compression:
Stored size: 616 Bytes
Contents
module Draper class DecoratorGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) DECORATORS_ROOT = 'app/decorators/' APPLICATION_DECORATOR = 'application_decorator.rb' APPLICATION_DECORATOR_PATH = DECORATORS_ROOT + APPLICATION_DECORATOR def build_model_and_application_decorators empty_directory "app/decorators" unless File.exists?(APPLICATION_DECORATOR_PATH) template APPLICATION_DECORATOR, APPLICATION_DECORATOR_PATH end template 'decorator.rb', "#{DECORATORS_ROOT}#{singular_name}_decorator.rb" end end end
Version data entries
7 entries across 7 versions & 1 rubygems