我尝试使用 gem wicked_pdf 将 Rails 视图转换为 pdf。但是当我像这样执行 render_to_string 时
ActionController::Base.new.render_to_string(template: "templates/pdf_meteo.html.erb", locals: {communaute_meteo_id: id}, layout: 'pdf')
Run Code Online (Sandbox Code Playgroud)
像这样的方法user_path
不起作用并返回未定义的方法错误...(请注意,如果我在 html 中呈现该页面,则该页面可以正常工作)如果有人可以帮助我!