Sha256: 181fd5d964d0087db22b21f8375f1aed6c1156d44514123466336cb90f585bc6

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

require 'rails/generators/erb'

module Rails
  module Generators
   class ResourceTemplateGenerator < Erb::Generators::Base
      source_root File.expand_path("../templates", __FILE__)

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

        [:index, :show].each do |action|
          @action = action
          @path = File.join(base_path, filename_with_extensions(action))
          template filename_with_extensions(action), @path
        end
      end

      protected

      def format
        nil
      end

      def handler
        :rabl
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rabl-generators-0.2.1 lib/rails/generators/resource_template_generator.rb
rabl-generators-0.2.0 lib/rails/generators/resource_template_generator.rb
rabl-generators-0.1.1 lib/rails/generators/resource_template_generator.rb