Rails - Ajax调用呈现我的动作和父页面

时间:2011-12-03 14:50:40

标签: ajax ruby-on-rails-3 twitter-bootstrap

在我的new控制器的contracts操作中,我有一个非REST动作的ajax链接

<%= link_to "Select negotiation", negotiations_list_negotiations_path(:user_id => current_user), {:remote => true, :id => 'related_negotiation_add_link',  'data-controls-modal'=>"related_negotiation", 'data-backdrop' => true, 'data-keyboard'=> true} %>

此链接填充模态窗口中的记录列表(我在这里使用Twitter的引导模式)。

它工作得很好,但我通过查看我的日志发现它还再次调用了new动作。请参阅下面的日志(我删除了SQL部分):

Started GET "/negotiations/negotiations_list?user_id=65" for 127.0.0.1 at 2011-12-03 15:47:24 +0100
  Processing by NegotiationsController#negotiations_list as JS
  Parameters: {"user_id"=>"65"}
Rendered negotiations/negotiations_list.js.erb (18.9ms)
Completed 200 OK in 78ms (Views: 24.7ms | ActiveRecord: 21.7ms)


Started GET "/contracts/new" for 127.0.0.1 at 2011-12-03 15:47:24 +0100
  Processing by ContractsController#new as */*
Rendered contracts/_submenu.html.erb (6.2ms)
Rendered shared/_category_dropdown.html.erb (14.0ms)
Rendered contracts/_form.html.erb (199.8ms)
Rendered contracts/new.html.erb within layouts/application (213.7ms)
Rendered shared/_flash.html.erb (0.0ms)
Completed 200 OK in 260ms (Views: 238.1ms | ActiveRecord: 18.3ms)

任何人都可以在/contracts/new动作再次触发时解释,以及如何停止此操作?

0 个答案:

没有答案