link_to:未定义的局部变量或方法' post'?

时间:2015-11-12 23:51:26

标签: ruby-on-rails ruby http post haml

我不知道我在这里缺少什么,因为这个特定部分的Ruby API文档是完全垃圾...我需要这个link_to来POST,但不管我做了什么它赢了# 39;取method: post选项。

= link_to "Remind", "#", class: "btn green invitation-reminder", method: post

我收到错误:

undefined local variable or method `post' for #<#<Class:0x007f378f9cb738>:0x007f378faa2fd0>

我知道这可能只是一个愚蠢的语法错误,但我对Ruby和Web框架一般来说还是一个新手,请耐心等待。 :)

1 个答案:

答案 0 :(得分:4)

传递符号 :post而不是遗漏的方法post

= link_to "Remind", "#", class: "btn green invitation-reminder", method: :post
相关问题