Sha256: d593a46526157b4b82301545e25ced97da56539bc5baf265c7adc80584014b3e

Contents?: true

Size: 833 Bytes

Versions: 10

Compression:

Stored size: 833 Bytes

Contents

require 'rails/generators/resource_helpers'

module Iord
  module Generators
    class ScaffoldGenerator < Rails::Generators::NamedBase
      include Rails::Generators::ResourceHelpers

      def self.source_root
        @_iord_source_root ||= File.expand_path("../templates", __FILE__)
      end

      check_class_collision

      argument :attributes, type: :array, default: [], banner: 'field[:type][:index] field[:type][:index]'

      class_option :resource_route, type: :boolean

      hook_for :orm, as: :model, required: true

      def create_controller_files
        template 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
      end

      hook_for :test_framework, as: :scaffold
      hook_for :resource_route, in: :rails, required: :true
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
iord-1.2.2 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.2.1 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.2.0 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.1.3 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.1.2 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.1.1 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.1.0 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.0.3 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.0.2 lib/rails/generators/iord/scaffold/scaffold_generator.rb
iord-1.0.1 lib/rails/generators/iord/scaffold/scaffold_generator.rb