在我的應用程序中,我必須附加excel和pdf,但它是通過一個錯誤。Excel和Pdf不能在RoR中工作
ActionView::MissingTemplate: Missing template self_services/show, application/show with {:locale=>[:en], :formats=>[:xls], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :axlsx, :jbuilder]}. Searched in:
下面是我的控制器代碼 -
def show_self_datewise_attendance
@from = params[:employee][:from]
@to = params[:employee][:to]
@employee_attendances = EmployeeAttendance.where(day: @[email protected]_date,employee_id: current_user.employee_id)
respond_to do |format|
format.js
format.xls {render template: 'self_services/datewise_attendance_report_xls.xls.erb'}
format.html
format.pdf do
render pdf: 'datewise_attendance_report_pdf',
layout: 'pdf.html',
orientation: 'Landscape',
template: 'self_services/datewise_attendance_report_pdf.pdf.erb',
# show_as_html: params[:debug].present?,
:page_height => 1000,
:dpi => '300',
:margin => {:top => 10, # default 10 (mm)
:bottom => 10,
:left => 20,
:right => 20},
:show_as_html => params[:debug].present?
end
end
end
試試這個希望它會工作http://stackoverflow.com/questions/9561000/actionviewmissingtemplate-missing-template –
到目前爲止,你有任何解決方案? –
還沒有@AniketShivamTiwari –