Sha256: e136a9e85b3282a5839754752baa80c81c0957e396011ec26c2267a4a12d01f1

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

Stored size: 719 Bytes

Contents

require 'rails'
require 'rails/generators/erb/scaffold/scaffold_generator'

module Builder
  module Generators
    class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
      source_root File.expand_path(File.join('..', 'templates'), __FILE__)

      def copy_view_files
        available_views.each do |view|
          filename = filename_with_extensions view
          template "#{view}.html.builder", File.join('app', 'views', controller_file_path, filename)
        end
      end

      def self.available_views
        ['index', 'show', 'new', 'edit', '_form']
      end

      def available_views
        self.class.available_views
      end

      def handler
        :builder
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
we_bridge-html_builder-0.1.7 lib/generators/builder/scaffold/scaffold_generator.rb
we_bridge-html_builder-0.1.6 lib/generators/builder/scaffold/scaffold_generator.rb
we_bridge-html_builder-0.1.5 lib/generators/builder/scaffold/scaffold_generator.rb
we_bridge-html_builder-0.1.4 lib/generators/builder/scaffold/scaffold_generator.rb