Sha256: c0d090bbc7e15ea14483a722eee64741da4b708185f0e41938fb2ff07d0c14b4

Contents?: true

Size: 743 Bytes

Versions: 3

Compression:

Stored size: 743 Bytes

Contents

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

module FormtasticHaml
  module Generators
    class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
      extend TemplatePath

      def copy_layout_file
        return unless options[:layout]
        template "layout.haml.erb",
                 File.join("app/views/layouts", controller_class_path, "#{controller_file_name}.html.haml")
      end
      
      def copy_view_files
        views = available_views
        views.delete("index") if options[:singleton]

        views.each do |view|
          template "#{view}.haml.erb", File.join("app/views", controller_file_path, "#{view}.html.haml")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails3-generators-0.8.2 lib/generators/formtastic_haml/scaffold/scaffold_generator.rb
rails3-generators-0.8.1 lib/generators/formtastic_haml/scaffold/scaffold_generator.rb
rails3-generators-0.8.0 lib/generators/formtastic_haml/scaffold/scaffold_generator.rb