Monday, June 3, 2024
165
rated 0 times [  171] [ 6]  / answers: 1 / hits: 36006  / 15 Years ago, tue, march 16, 2010, 12:00:00

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!');


should actually produce an alert on click. very simple. does not work on my rails3 project! (also no error output!) any ideas?



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


even the rails3 api does not help me here: http://rails3api.s3.amazonaws.com/index.html



help!


More From » ruby-on-rails-3

 Answers
146

ok it looks like the new unobtrusive javascript changes introduced the problem.
see the following post for more information if you run into similar issues
http://blog.loopedstrange.com/modest-rubyist-archive/rails-3-ujs-and-csrf-meta-tags



 <%= csrf_meta_tag %>


fixed things for me.


[#97318] Sunday, March 14, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dayshadelaniej

Total Points: 668
Total Questions: 121
Total Answers: 121

Location: Sao Tome and Principe
Member since Wed, Dec 21, 2022
1 Year ago
;