Sha256: c46de5f674954454c9a3f7323a34020cab96e38fd93f404453959a2a741eeae5

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

require 'rails/generators/erb'

module Rails
  module Generators
   class ResourceTemplateGenerator < Erb::Generators::Base
      argument :actions, type: :array, default: [], banner: "action action"
      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

1 entries across 1 versions & 1 rubygems

Version Path
rabl-generators-0.1.0 lib/rails/generators/resource_template_generator.rb