我在PurchaseOrdersController中有一个名为“modify”的方法,它在视图目录中也有它的模板(modify.slim)。
让我们说,我正在这条路上http://localhost:3000/purchase_orders/modify?prid=1
问题是,当我要点击打开newtab的锚标签('/po/1.pdf')时,:
NoMethodError (undefined method formats for "modify":String
Did you mean? form_tag):
当我点击刷新页面http://localhost:3000/purchase_orders/modify?prid=1
时发生。
有谁有想法如何解决这个问题?我正在使用Rails 5.2.1。
谢谢。
为了让Rails正确加载文件,请确保您所包含的所有模块都在相应的类中完成。例如:
class MyClass
include ActionView::Helpers
end