开发者

ID from Controller#show

开发者 https://www.devze.com 2023-02-14 17:41 出处:网络
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:

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

精彩评论

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