问题描述
我想知道当前的rails3 master中是否完全破坏了基本的link_to语法,或者我是否在这里做了一些错误的语法。
i am wondering if the basic link_to syntax is completely broken in current rails3 master or if i am doing some wrong syntax here.
= link_to "name", nil, :onlick => "alert('Hello world!');"
实际上应该在点击时产生警报。非常简单。不适用于我的rails3项目! (也没有错误输出!)任何想法?
should actually produce an alert on click. very simple. does not work on my rails3 project! (also no error output!) any ideas?
一般link_to语法我找不到一个例子,我可以将link_to_remote与确认,远程和html类结合起来(请参阅下面的尝试)
for the general link_to syntax i could not find an example where i could combine a link_to_remote with a confirmation, remote and html class (see my try below)
= link_to "delete", {:action => "destroy", :remote => true, :method => :delete, :confirm => "#{a.title} wirklich Löschen?" }, :class => "trash"
即使是rails3 api也没有帮助我:
even the rails3 api does not help me here: http://rails3api.s3.amazonaws.com/index.html
帮助!
推荐答案
好吧看起来新的不引人注目的javascript变化引入了这个问题。
如果您遇到类似问题,请参阅以下帖子了解更多信息
ok it looks like the new unobtrusive javascript changes introduced the problem.see the following post for more information if you run into similar issueshttp://blog.loopedstrange.com/modest-rubyist-archive/rails-3-ujs-and-csrf-meta-tags
<%= csrf_meta_tag %>
为我修好了东西。
这篇关于link_to语法与rails3(link_to_remote)和基本的javascript无法在rails3应用程序中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!