2

Searched around for a while, the common solution to it is to insert <%= csrf_meta_tags %> to layout header. However, it makes no difference. Installing jquery-rails doesn't help either

Rails 3.1.0 Ruby 1.9.2 Mongoid 2.2.0

Another weird thing after coming to 3.1 is that when I check routes by rake routes, there are some urls not specified by url helpers, like GET, PUT and DELETE have the same url but only the first one cat be reached by helper defined url.

edit_message GET /:permalink/messages/:id/edit(.:format){:action=>"edit", :controller=>"messages"}

message GET /:permalink/messages/:id(.:format){:action=>"show", :controller=>"messages"}

         PUT    /:permalink/messages/:id(.:format)  {:action=>"update", :controller=>"messages"}

         DELETE /:permalink/messages/:id(.:format) {:action=>"destroy", :controller=>"messages"}
aquajach
  • 2,548
  • 2
  • 23
  • 29
  • to update from rails 3.0.2 to 3.1 you should first upgrade to rails 3.0.10, which will help you fix deprecations, but actually I don't think this applies to your case. – ecoologic Sep 20 '11 at 13:13
  • actually these problems were found even in 3.0.10 – aquajach Sep 23 '11 at 09:00

1 Answers1

1

The first half part of the question was solved by adding token to each ajax request. Because starting with Rails 3.0.4 (if I remember), Rails requires each ajax request to carry with authenticity token if you put protect_from_forgery in your application controller.

aquajach
  • 2,548
  • 2
  • 23
  • 29