Sha256: ffabdf7cf7fee2c4acc0e0b99824305987cc0287fd5491c437998b8b5f16ed0b

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

module Draper
  class DecoratorGenerator < Rails::Generators::NamedBase
    desc <<-DESC
    Description:
        Generate a decorator for the given model.
        Example: rails g draper:decorator Article
                    generates: "app/decorators/article_decorator"
                               "spec/decorators/article_decorator_spec"
    DESC
    
    source_root File.expand_path('../templates', __FILE__)

    DECORATORS_ROOT = 'app/decorators/'

    def build_model_decorator
      template 'decorator.rb', "#{DECORATORS_ROOT}#{singular_name}_decorator.rb"
    end

    hook_for :test_framework
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
draper-0.10.0 lib/generators/draper/decorator/decorator_generator.rb