Class: Rails::Generators::JbuilderGenerator

Inherits:
NamedBase
  • Object
show all
Includes:
ResourceHelpers
Defined in:
lib/generators/rails/jbuilder_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#copy_view_filesObject



20
21
22
23
24
25
26
# File 'lib/generators/rails/jbuilder_generator.rb', line 20

def copy_view_files
  %w(index show).each do |view|
    filename = filename_with_extensions(view)
    template filename, File.join('app/views', controller_file_path, filename)
  end
  template filename_with_extensions('partial'), File.join('app/views', controller_file_path, filename_with_extensions("_#{singular_table_name}"))
end

#create_root_folderObject



15
16
17
18
# File 'lib/generators/rails/jbuilder_generator.rb', line 15

def create_root_folder
  path = File.join('app/views', controller_file_path)
  empty_directory path unless File.directory?(path)
end