开发者

Ruby on Rails. How to show record only once?

开发者 https://www.devze.com 2022-12-13 16:40 出处:网络
I want to know how to show a record only exactly after it was created. So i want to show it only once.

I want to know how to show a record only exactly after it was created. So i want to show it only once.

Just see. I have model called Claim. User creates new Claim (user is anonymous). I want to show this Claim only ofter user creates it and never again. How can I do it?

I think th开发者_运维百科at I can use flash hash, but i think it is not enough secure to create symbols from user data.


You could have a viewed attribute on your model that you set to true in the show action. If viewed is true then skip rendering the view.

unless thingy.viewed 
  thingy.viewed = true
  thingy.save

  render like normal...
end
0

精彩评论

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