Sha256: e1d29339470815e4bfa15a0c622668d438e494a6e749f9d948e67121348b6344

Contents?: true

Size: 868 Bytes

Versions: 48

Compression:

Stored size: 868 Bytes

Contents

require 'rails/generators'
require 'generators/rails/jbuilder_generator'

module Incline::Extensions
  ##
  # Adds _details view to jbuilder.
  module JbuilderGenerator

    ##
    # Overrides the copy_view_files method to include the _details view.
    def self.included(base)
      base.class_eval do

        source_root File.expand_path('../../../templates/jbuilder/scaffold', __FILE__)

        undef copy_view_files

        def copy_view_files
          available_views.each do |view|
            filename = filename_with_extensions(view)
            template filename, File.join('app/views', controller_file_path, filename)
          end
        end

        protected

        def available_views
          %w(index show _details)
        end

      end
    end

  end
end

Rails::Generators::JbuilderGenerator.include Incline::Extensions::JbuilderGenerator

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
incline-0.3.14 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.13 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.12 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.11 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.10 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.9 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.8 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.7 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.6 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.5 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.4 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.3 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.2 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.1 lib/incline/extensions/jbuilder_generator.rb
incline-0.3.0 lib/incline/extensions/jbuilder_generator.rb
incline-0.2.36 lib/incline/extensions/jbuilder_generator.rb
incline-0.2.35 lib/incline/extensions/jbuilder_generator.rb
incline-0.2.34 lib/incline/extensions/jbuilder_generator.rb
incline-0.2.28 lib/incline/extensions/jbuilder_generator.rb
incline-0.2.27 lib/incline/extensions/jbuilder_generator.rb