开发者

ID from Controller#show

I would like to retrieve the id of the current item in a Controller#show page. How is this done? I can't seem to fig开发者_运维技巧ure this out or find it anywhere.


You're probably looking for:

<%= params[:id] %>

There are lots of things wrong with doing this, one of which is it can open you up to CSRF attacks. Make sure to escape your output (this is done automatically in rails 3.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜