active_scaffold w / Rails 3.2没有为搜索,编辑,新动作等提供可见的响应

时间:2013-03-15 17:19:38

标签: jquery ruby-on-rails ruby-on-rails-3.2 prototypejs activescaffold

我添加了几个带有活动脚手架的模型和控制器。但是,每当我单击任何操作(如新建,编辑,搜索,显示等)时,浏览器中都不会显示任何内容。似乎服务器正在响应它,因为日志显示:

Started GET "/organisms/1" for 127.0.0.1 at 2013-03-15 12:55:35 -0400
Processing by OrganismsController#show as JS
  Parameters: {"id"=>"1"}
  Organism Load (0.4ms)  SELECT "organisms".* FROM "organisms" WHERE "organisms"."id" = $1 LIMIT 1  [["id", "1"]]
   (0.4ms)  SELECT COUNT(*) FROM "genes" WHERE "genes"."organism_id" = 1
  Rendered /opt/local/lib/ruby1.9/gems/1.9.1/gems/active_scaffold-3.2.19/frontends/default/views/_show_columns.html.erb (2.9ms)
  Rendered /opt/local/lib/ruby1.9/gems/1.9.1/gems/active_scaffold-3.2.19/frontends/default/views/_show.html.erb (15.4ms)
Completed 200 OK in 32ms (Views: 26.0ms | ActiveRecord: 0.9ms)

但浏览器窗口中没有任何变化。 Firebug'Net'日志显示响应标题:

 Cache-Control  max-age=0, private, must-revalidate Connection  close
 Content-Type   text/javascript; charset=utf-8
 Etag   "c08465bfa6a67a8fb4f88964513a6b23" Server   thin 1.5.0 codename
 Knife X-Request-Id 6ee347aa85988460733ffbda65ea12ee X-Runtime  0.036693
 X-UA-Compatible    IE=Edge

对我来说,回复看起来像html:

<h4></h4>

<dl>
  <dt>Name</dt>
    <dd class="name-view">
    - &nbsp;
  </dd>
  <dt>Genes</dt>
    <dd class="genes-view">
    - &nbsp;
  </dd>
</dl>

<p class="form-footer">
  <a href="/organisms" class="as_cancel" data-remote="true">Close</a>
  <img alt="loading indicator" class="loading-indicator" id="as_organisms-create-1-loading-indicator" src="/assets/active_scaffold/indicator.gif" style="visibility:hidden;" />
</p>

我怀疑这个问题有两个问题:

  1. 响应标题提到js,但响应正文是HTML。虽然我认为这可能发生在AJAX上。
  2. 我在我的资产中使用jquery(application.js标头),而active_scaffold可以尝试使用原型。我该如何检查?请注意,在Rails 3.2中,安装active_scaffold gem时没有提到原型或jquery:https://github.com/activescaffold/active_scaffold/wiki/Getting-Started

1 个答案:

答案 0 :(得分:0)

页面上的数据是否在变化?我认为activescaffold正在使用ajax重新渲染页面的某些部分,因此您不会看到孔页面发生变化。如果屏幕上没有任何不同,那么看起来似乎没有任何反应。

答案:使用git master gem 'active_scaffold', :git => 'git://github.com/activescaffold/active_scaffold.git'详见