lib/eucalypt/eucalypt-generate/namespaces/generate-controller/generators/controller.rb in eucalypt-0.1.3 vs lib/eucalypt/eucalypt-generate/namespaces/generate-controller/generators/controller.rb in eucalypt-0.2.0
- old
+ new
@@ -12,11 +12,11 @@
def self.source_root
File.join File.dirname(__dir__), 'templates'
end
- def generate(spec: true, rest: false, policy: false, name:)
+ def generate(spec: true, rest: false, policy: false, headless: false, name:)
controller = Inflect.new(:controller, name)
route = '/' << (rest ? controller.route_name.pluralize : controller.route_name)
controller_file_name = String.build do |s|
@@ -32,10 +32,11 @@
route: route,
constant: controller.constant,
class_name: controller.class_name,
helper_class_name: helper.class_name,
resource: controller.resource,
- resources: controller.resources
+ resources: controller.resources,
+ headless: headless
}
template(controller_template, controller.file_path, config)
template("controller_spec.tt", controller.spec_path, config) if spec
end