Sha256: 1262049606e4e27c62b01e2c990d0557d2e142a6f93c31bb49db2bebeb775cae

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

# rails generate effective:scaffold NAME [field[:type] field[:type]] [options]

# Generates a migration, model, datatable, routes, controller, views

# rails generate effective:scaffold Thing
# rails generate effective:scaffold admin/thing name:string details:text --actions index show edit update
# rails generate effective:scaffold admin/thing name:string details:text

module Effective
  module Generators
    class ScaffoldControllerGenerator < Rails::Generators::NamedBase
      include Helpers

      source_root File.expand_path(('../' * 4) + 'lib/scaffolds', __FILE__)

      desc 'Creates an Effective Scaffold'

      argument :attributes, type: :array, default: [], banner: 'field[:type] field[:type]'
      class_option :actions, type: :array, default: ['crud'], desc: 'Included actions', banner: 'index show'

      def invoke_controller
        Rails::Generators.invoke('effective:controller', [name] + invoked_actions + invoked_attributes_args)
      end

      def invoke_route
        Rails::Generators.invoke('effective:route', [name] + invoked_actions)
      end

      def invoke_ability
        Rails::Generators.invoke('effective:ability', [name] + invoked_actions)
      end

      def invoke_menu
        Rails::Generators.invoke('effective:menu', [name])
      end

      def invoke_datatable
        Rails::Generators.invoke('effective:datatable', [name] + invoked_attributes)
      end

      def invoke_views
        Rails::Generators.invoke('effective:views', [name] + invoked_actions + invoked_attributes_args)
      end

      def invoke_form
        Rails::Generators.invoke('effective:form', [name] + invoked_attributes)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_developer-0.0.9 lib/generators/effective/scaffold_controller_generator.rb