class Rails::Generators::ScaffoldControllerGenerator

:nodoc:

def attachments?(name)

def attachments?(name)
  attribute = attributes.find { |attr| attr.name == name }
  attribute&.attachments?
end

def create_controller_files

def create_controller_files
  template_file = options.api? ? "api_controller.rb" : "controller.rb"
  template template_file, File.join("app/controllers", controller_class_path, "#{controller_file_name}_controller.rb")
end

def permitted_params

def permitted_params
  attachments, others = attributes_names.partition { |name| attachments?(name) }
  params = others.map { |name| ":#{name}" }
  params += attachments.map { |name| "#{name}: []" }
  params.join(", ")
end