Class: Curly::Generators::ScaffoldGenerator

Inherits:
Base
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/curly/scaffold/scaffold_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#copy_view_filesObject


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/curly/scaffold/scaffold_generator.rb', line 18

def copy_view_files
  available_views.each do |view|
    # Useful in the presenters.
    @view_name = presenter_view(view)
    # Example:  posts/index.html.curly
    view_file = "#{view}.#{format}.curly"
    template "#{view_file}.erb", File.join("app/views", controller_file_path, view_file)
    # Example: posts/index_presenter.rb
    presenter_file = "#{@view_name}_presenter.rb"
    template "#{presenter_file}.erb", File.join("app/presenters", controller_file_path, presenter_file)
  end
end

#create_root_folderObject


13
14
15
16
# File 'lib/generators/curly/scaffold/scaffold_generator.rb', line 13

def create_root_folder
  empty_directory File.join("app/views", controller_file_path)
  empty_directory File.join("app/presenters", controller_file_path)
end