Sha256: 6e8b50db8bb8f250c96052c2480c8b1a513907e562b4f3f74d79b2360427271d

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

require 'generators/simple_form'
require 'rails/generators/named_base'

module SimpleFormHaml
  module Generators
    class ControllerGenerator < Rails::Generators::NamedBase
      extend TemplatePath
      
      argument :actions, :type => :array, :default => [], :banner => "action action"

      def create_view_files
        base_path = File.join("app/views", class_path, file_name)
        empty_directory base_path

        actions.each do |action|
          @action = action
          @path   = File.join(base_path, "#{action}.html.haml")

          template 'view.html.haml', @path
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails3-generators-0.8.2 lib/generators/simple_form_haml/controller/controller_generator.rb
rails3-generators-0.8.1 lib/generators/simple_form_haml/controller/controller_generator.rb
rails3-generators-0.8.0 lib/generators/simple_form_haml/controller/controller_generator.rb