Module: Incline::Extensions::JbuilderGenerator

Defined in:
lib/incline/extensions/jbuilder_generator.rb

Overview

Adds _details view to jbuilder.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Overrides the copy_view_files method to include the _details view.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/incline/extensions/jbuilder_generator.rb', line 11

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