nee*_*zer 10 forms post ruby-on-rails external
我在另一个网站(使用不同的后端)上有一个表单,我希望能够POST到我的Rails应用程序(在不同的域上).
谢谢您的帮助!
Sim*_*tti 19
您无法从Rails应用程序外部生成Autenticity令牌.您可以做的是仅为此操作禁用令牌保护,并使用基于before_filter的自定义实现.
skip_before_filter :verify_authenticity_token, :only => :my_action
before_filter :verify_custom_authenticity_token, :only => :my_action
def verify_custom_authenticity_token
# checks whether the request comes from a trusted source
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3609 次 |
| 最近记录: |