Using turbolinks in a Rails link_to

前端 未结 6 1231
臣服心动
臣服心动 2020-11-29 03:14

Just wondering whether there\'s a way to use turbolinks directly in a rails link_to helper, a quick bit of googling didn\'t uncover anything of note, here\'s the type of thi

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 03:58

    You can use a symbol without problems to generate the following code:

     Giraffe
    

    Just do the following:

     <%= link_to 'Giraffe', giraffe_path(@giraffe),
                 :data => { :no_turbolink => true } %>
    

    Note: :no_turbolink will become no-turbolink and the value will be converted to JSON automatically using to_json, e.g. true to "true".

提交回复
热议问题