次のショートカットはありますか:
link_to 'title', path, 'data-type' => :html
に変換するの:type=>:html
と同じように機能すると思いましたが、サポートされていません。:remote=>true
data-remote='true'
次のショートカットはありますか:
link_to 'title', path, 'data-type' => :html
に変換するの:type=>:html
と同じように機能すると思いましたが、サポートされていません。:remote=>true
data-remote='true'
はい:
link_to 'title', path, data: { type: :html }
小編集
タグヘルパーから来ています: http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-tag
あなたのケースではショートカットではないかもしれませんが、複数のデータ属性を設定する必要がある場合は非常に便利です:
link_to 'title', path, data: { first_name: @user.first_name,
last_name: @user.last_name,
# etc. }
でもいや、いやtype: :html
、ごめんなさい…