Rails: link_to の :popup オプションは Rails 3 で廃止予定(DEPRECATED)

廃止予定となっていますが、現実にはもう使えません。

回避策は以下の通り:

  1. :popup => true を 'data-popup' => true に書き換える。
  2. public/javascripts/application.js に次のコードを追加する。

(prototypeの場合)


document.on("click", "a[data-popup='true']", function(event, element) {
if (event.stopped) return;
window.open($(element).href);
event.stop();
});

(jQueryの場合)


$('a[data-popup='true']').live('click', function(e) {
window.open($(this).href);
e.preventDefault();
});

参考資料: