1

这看起来非常简单,但不知何故我被卡住了,我有一个配置文件脚手架,当用户单击 index.html.erb 上的配置文件时,我希望配置文件在同一页面上打开,而不是转到 /profile/1

在 index.html.erb 中

我已经添加了

<div id="show_profile">
...
<td><%= link_to profile.name, profile, remote: true, :id => "show_profile" %></td>
...
</div>

在 profile_controller.rb

我已经添加了

def index
  ...
  format.js
end

我还使用以下代码添加了 show.js.erb

$('#show_profile').('<%= j render("show") %>');

但是当我点击链接时,什么也没有发生,我错过了什么?

4

0 回答 0