Skip to content

Use a template from another directory #62

Description

@galievruslan

Hello

I'm using the version of htmltoword 0.5.1

My controller code

class ReportsController < ApplicationController
  respond_to :docx
  def run
    @report = Report.find(params[:id])
  end

  def execute
    @report = Report.find(params[:id])
    @params = params
    @user = current_user
    if @report.format == 'html'
      render @report.template.path
    elsif @report.format == 'docx'
      file_name = @report.name + '.' + @report.format
      render docx: @report.template.path, filename: file_name
    elsif @report.format == 'xlsx'
      file_name = @report.name + '.' + @report.format
      render file: @report.template.path
    end
  end
end

Reports are created and their templates are downloaded with carrierwave to the folder
/uploads/report_templates/13/REPORT_NAME

But if I use the code I wrote above, then the application gives an error 404.
Tell me how it can be fixed or bypassed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions