[英]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.