Sha256: ff8660ae2d6fc3da54a44821e4d0b6eabb44b37b404423d98d32e1f7bacb3709

Contents?: true

Size: 600 Bytes

Versions: 6

Compression:

Stored size: 600 Bytes

Contents

require "thor/group"
require 'active_support/inflector'

module Corneal
  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

6 entries across 6 versions & 2 rubygems

Version Path
corneal-new-1.3.1 lib/corneal/generators/scaffold/scaffold_generator.rb
corneal-new-1.3.0 lib/corneal/generators/scaffold/scaffold_generator.rb
corneal-1.2.3 lib/corneal/generators/scaffold/scaffold_generator.rb
corneal-1.2.2 lib/corneal/generators/scaffold/scaffold_generator.rb
corneal-1.2.1 lib/corneal/generators/scaffold/scaffold_generator.rb
corneal-1.2.0 lib/corneal/generators/scaffold/scaffold_generator.rb