Sha256: 18767e912d0da8822205e55708302d3ed0d0654ee0401bb20f8164cf75ff3f2f

Contents?: true

Size: 676 Bytes

Versions: 3

Compression:

Stored size: 676 Bytes

Contents

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

module Slim
  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.slim", File.join 'app', 'views', controller_file_path, filename
        end
      end

      hook_for :form_builder, :as => :scaffold

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

      def handler
        :slim
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slim-rails-1.0.2 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-1.0.1 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-1.0.0 lib/generators/slim/scaffold/scaffold_generator.rb