Sha256: 7f73a59f595bd9d8c19e538ee29eb74d57fbe66cd1f69b48b31013475f63e0d3

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

require 'generators/formtastic_haml'
require 'rails/generators/named_base'

module FormtasticHaml
  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.haml.erb', @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/formtastic_haml/controller/controller_generator.rb
rails3-generators-0.8.1 lib/generators/formtastic_haml/controller/controller_generator.rb
rails3-generators-0.8.0 lib/generators/formtastic_haml/controller/controller_generator.rb