Rails 2 to Rails 3 : using link_to instead of link_to_remote (including remote and update)

前端 未结 2 1273
猫巷女王i
猫巷女王i 2020-12-06 07:06

A quick and easy answer I\'m sure. I\'m upgrading a Rails project from version 2 to version 3 and replacing a load of the link_to_remote with link_to\'s as per the Rails 3

相关标签:
2条回答
  • 2020-12-06 07:41

    The :update option isn't supported by the new link_to :remote => true.

    You will either have to

    • use the legacy plugin
    • write the JS/AJAX yourself instead of using :remote => true
    • use render :update { |page| p.replace_html ... }
    0 讨论(0)
  • 2020-12-06 07:41

    The :update parameter is gone. You need to handle the DOM update yourself using Unobtrusive JavaScript. Also, make sure you actually included the csrf_meta_tag helper in your layout.

    I wrote an article about using unobtrusive JavaScript in Rails 3.

    0 讨论(0)
提交回复
热议问题