Sha256: 4d1ec63fc1468bfb7d99fb07ef6fbbe64af016b985ad2b98c780dadf2a4b3847

Contents?: true

Size: 598 Bytes

Versions: 3

Compression:

Stored size: 598 Bytes

Contents

require "thor/group"
require 'active_support/inflector'
module Natra
  module Generators
    class ScaffoldGenerator < Thor::Group
      include Thor::Actions

      desc 'Generate an ActiveRecord model with it\'s associated views and controllers'
      argument :name, type: :string, desc: 'Name of the model'
      argument :attributes, type: :array, default: [], banner: 'field:type field:type'

      def create_model
        ModelGenerator.new([name, attributes]).invoke_all
      end

      def create_controller
        ControllerGenerator.new([name]).invoke_all
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
natra-0.0.6 lib/natra/generators/scaffold/scaffold_generator.rb
natra-0.0.5 lib/natra/generators/scaffold/scaffold_generator.rb
natra-0.0.4 lib/natra/generators/scaffold/scaffold_generator.rb