Sha256: 0fdeed06dde7bb53b6a43c4d6781740417fa2039a468512a424c112f8a53ba03

Contents?: true

Size: 628 Bytes

Versions: 3

Compression:

Stored size: 628 Bytes

Contents

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

module SimpleFormErb
  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/simple_form_erb/controller/controller_generator.rb
rails3-generators-0.8.1 lib/generators/simple_form_erb/controller/controller_generator.rb
rails3-generators-0.8.0 lib/generators/simple_form_erb/controller/controller_generator.rb