Class: InheritedResourcesViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/inherited_resources_views/generators/legacy_generator.rb,
lib/generators/inherited_resources_views/generators/current_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/generators/inherited_resources_views/generators/current_generator.rb', line 7

def self.source_root
  @_views_source_root ||= File.expand_path("../../templates/app/views", __FILE__)
end

Instance Method Details

#copy_viewsObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/inherited_resources_views/generators/current_generator.rb', line 11

def copy_views
  case options[:template_engine].to_sym
  when :haml
    verify_haml_existence
    verify_haml_version
    create_and_copy_haml_views
  else
    directory "inherited_resources", "app/views/inherited_resources"
  end
end

#manifestObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/inherited_resources_views/generators/legacy_generator.rb', line 2

def manifest
  directory = "app/views/inherited_resources"
  record do |m|
    m.directory directory
    m.file "#{directory}/_form.html.erb", "#{directory}/_form.html.erb"
    m.file "#{directory}/edit.html.erb", "#{directory}/edit.html.erb"
    m.file "#{directory}/index.html.erb", "#{directory}/index.html.erb"
    m.file "#{directory}/new.html.erb", "#{directory}/new.html.erb"
    m.file "#{directory}/show.html.erb", "#{directory}/show.html.erb"
  end
end