[英]Rails not able to render page as json
I have a URL like this : localhost/events/show?eId=12345.json
我有一个这样的URL:
localhost/events/show?eId=12345.json
When I perform : model.find(params[:eId])
当我执行时:
model.find(params[:eId])
It considers .json
part of eId
and says no id found for 12345.json
. 它认为
.json
的一部分eId
,没有发现ID说12345.json
。 To resolve this issue, I excluded .json
from eId
and it then shows the html page. 要解决这个问题,我排除
.json
从eId
,然后它显示HTML页面。 But I need to be able to also see the .json
page. 但是我还需要能够看到
.json
页面。
So it doesn't recognize that I need to view page as json. 因此,它无法识别我需要将页面查看为json。
尝试localhost/events/show.json?eId=12345
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.