Sha256: 301d8e323daaec8b30a81f50689897152004d8c513d901b09bdff0d7e1ab94b1

Contents?: true

Size: 681 Bytes

Versions: 13

Compression:

Stored size: 681 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

13 entries across 13 versions & 1 rubygems

Version Path
slim-rails-3.0.0 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.1.5 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.1.4 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.1.3 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.1.2 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.1.0 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.0.4 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.0.3 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.0.2 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-2.0.1 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-1.1.1 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-1.1.0 lib/generators/slim/scaffold/scaffold_generator.rb
slim-rails-1.0.3 lib/generators/slim/scaffold/scaffold_generator.rb