active_scaffold w/ Rails 3.2对搜索、编辑、新建操作等没有可见的响应



我添加了一对具有活动支架的模型和控制器。然而,每当我点击新建、编辑、搜索、显示等操作时,浏览器中什么也看不见。服务器似乎正在响应它,如日志所示:

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时不会提到prototype或jquery: https://github.com/activescaffold/active_scaffold/wiki/Getting-Started

页面上的数据是否在变化?我认为activescaffold是使用ajax重新渲染页面的部分,所以你不会看到洞页面的变化。如果屏幕上没有什么不同,那么它看起来就像什么也没发生。

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

相关内容

  • 没有找到相关文章

最新更新