Sha256: 747bb1b31cd567f6e20c1af1036ebf9fb5f048fe70a7e42390e7fc01cd96fadf

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

require 'generators/formtastic_erb'
require 'rails/generators/named_base'

module FormtasticErb
  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.erb")

          template 'view.html.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_erb/controller/controller_generator.rb
rails3-generators-0.8.1 lib/generators/formtastic_erb/controller/controller_generator.rb
rails3-generators-0.8.0 lib/generators/formtastic_erb/controller/controller_generator.rb