Class: Edgarj::PopupScaffoldGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_edgarj_routesObject



9
10
11
# File 'lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb', line 9

def add_edgarj_routes
  route "edgarj_popup_resources :#{file_name.pluralize}_popup"
end

#create_controller_filesObject



13
14
15
16
# File 'lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb', line 13

def create_controller_files
  template 'controller.rb', File.join('app/controllers',
      class_path, "#{controller_file_name}_popup_controller.rb")
end

#create_helperObject



30
31
32
33
# File 'lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb', line 30

def create_helper
  template 'helper.rb', File.join('app/helpers',
      class_path, "#{controller_file_name}_popup_helper.rb")
end

#create_testObject

hook_for :test_framework, as: :popup_scaffold

hook_for :helper, in: :rails, as: :popup_scaffold do |invoked|
  invoke invoked, [ controller_name ]
end


25
26
27
28
# File 'lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb', line 25

def create_test
  template 'functional_test.rb', File.join('test/functional',
      class_path, "#{controller_file_name}_popup_controller_test.rb")
end