def create_controller
unless options.skip_controller?
template 'controller.rb', "app/controllers/#{plural_name}_controller.rb"
template 'helper.rb', "app/helpers/#{plural_name}_helper.rb"
controller_actions.each do |action|
if %w[index show new edit].include?(action)
template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/#{plural_name}/#{action}.html.#{view_language}"
end
end
if form_partial?
template "views/#{view_language}/_form.html.#{view_language}", "app/views/#{plural_name}/_form.html.#{view_language}"
end
namespaces = plural_name.split('/')
resource = namespaces.pop
route namespaces.reverse.inject("resources :#{resource}") { |acc, namespace|
"namespace(:#{namespace}){ #{acc} }"
}
if test_framework == :rspec
template "tests/#{test_framework}/controller.rb", "spec/controllers/#{plural_name}_controller_spec.rb"
else
template "tests/#{test_framework}/controller.rb", "test/functional/#{plural_name}_controller_test.rb"
end
end
end