[英]Why doesn't `posts_path` work in `rails console`?
為什么link_to 'Back', posts_path
在ERB中工作但posts_path
在控制台中不起作用?
$ rails console
irb(main):005:0> posts_path
NameError: undefined local variable or method `posts_path' for main:Object
您需要在控制台中添加app
上下文。
app.posts_path
app.get app.posts_path
app.response
app.response.body
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.