RoR – 将param传递给Bootstrap模态。 背景不淡出
我显示配置文件列表,需要通过模式显示每个用户的更多详细信息:
:profile_modal, :profile_id_param => profile.id }, {remote: true, 'data-toggle' => 'modal', 'data-target' => '#modal-window'} %>
这是模态的容器fiv:
控制器动作:
def profile_modal @profile = Profile.find_by_id(params[:profile_id_param]) respond_to do |format| format.js # format.html end end
和profile_modal.js.erb:
$("#modal-window").html(""); $("#profile_modal").modal();
莫代尔: