Class: SimpleFormHaml::Generators::ScaffoldGenerator

Inherits:
Erb::Generators::ScaffoldGenerator
  • Object
show all
Extended by:
TemplatePath
Defined in:
lib/generators/simple_form_haml/scaffold/scaffold_generator.rb

Instance Method Summary collapse

Methods included from TemplatePath

source_root

Instance Method Details

#copy_layout_fileObject



9
10
11
12
13
# File 'lib/generators/simple_form_haml/scaffold/scaffold_generator.rb', line 9

def copy_layout_file
  return unless options[:layout]
  template "layout.haml.erb",
           File.join("app/views/layouts", controller_class_path, "#{controller_file_name}.html.haml")
end

#copy_shared_filesObject



15
16
17
18
# File 'lib/generators/simple_form_haml/scaffold/scaffold_generator.rb', line 15

def copy_shared_files
  template "_form_errors.haml.erb",
           File.join("app/views/shared", "_form_errors.html.haml")
end

#copy_view_filesObject



20
21
22
23
24
25
26
27
# File 'lib/generators/simple_form_haml/scaffold/scaffold_generator.rb', line 20

def copy_view_files
  views = available_views
  views.delete("index") if options[:singleton]

  views.each do |view|
    template "#{view}.haml.erb", File.join("app/views", controller_file_path, "#{view}.html.haml")
  end
end