Script & CSS

2008年2月16日 星期六

No :secret given to the #protect_from_forgery call 錯誤的解決方法

Rails 2.0 開啟 db based session 時,程式執行會出現下列錯誤訊息

No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store).

若要解決此問題,必須將 app\controllers\application.rb中的
protect_from_forgery # :secret => 'your_secret_id'
修改為
protect_from_forgery :secret => 'your_secret_id'

即可將此問題排除。

沒有留言: