Sha256: 79b912241bd6c6bfea5849d5d298108283a10e4cc87f79e849afb387e8ae98ef

Contents?: true

Size: 628 Bytes

Versions: 8

Compression:

Stored size: 628 Bytes

Contents

require 'rails/generators/migration'
require 'rails/generators/active_record/migration'

module Bodega
  module Generators
    class ProductGenerator < Rails::Generators::Base
      argument :product_name, type: :string

      include Rails::Generators::Migration
      extend ActiveRecord::Generators::Migration

      source_root File.expand_path('../templates', __FILE__)

      def copy_migration
        migration_template "migration.rb", "db/migrate/create_#{product_name.tableize}"
      end

      def copy_model
        template "model.rb", "app/models/#{product_name.tableize.singularize}"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bodega-0.4.12 lib/generators/bodega/product/product_generator.rb
bodega-0.4.9 lib/generators/bodega/product/product_generator.rb
bodega-0.4.4 lib/generators/bodega/product/product_generator.rb
bodega-0.4.3 lib/generators/bodega/product/product_generator.rb
bodega-0.4.2 lib/generators/bodega/product/product_generator.rb
bodega-0.4.1 lib/generators/bodega/product/product_generator.rb
bodega-0.4.0 lib/generators/bodega/product/product_generator.rb
bodega-0.3.0 lib/generators/bodega/product/product_generator.rb