Search code examples
ruby-on-railsajaxrjslink-to-remote

Issues using a link_to_remote to change the state of the database?


anyone know of any issues using a link_to_remote to change the state of the database? I'm taking about issues with spiders, google accelerator etc. Twitter seems to do it with no problem. Thanks


Solution

  • Generally anything engaged only with JavaScript or using a non-GET method is safe from this sort of thing. Rails also has a special field send with each POST to ensure that the form was generated by the application and not a third-party site.

    This is why in Rails 2.x the destroy methods require DELETE to be routed properly. Prior to this there were GET-based destroy calls with a slightly different path and that created the exact problems you are describing.