转换为rails 4.1后的空白页面

时间:2014-04-17 08:16:04

标签: ruby-on-rails ruby-on-rails-4

从rails 3.2转换为rails 4.1后,它会在每个动作上呈现空白页面。 只是

Started GET "/" for 127.0.0.1 at 2014-04-17 10:50:59 +0300
Processing by SomeController#index as HTML
Completed 200 OK in 303ms (Views: 0.2ms | ActiveRecord: 1.2ms)

我的配置错过了什么?路线错误?

==== 更新 =====

我在app / views / some / index.html.erb中有一个视图 使用像

这样的代码
somestring code
<script>
  somejscode
</script>

呈现的html似乎是空的(除了chrome addons js):

<html>
  <head>
    <style type="text/css"></style>
  </head>
  <body>
    <pre style="word-wrap: break-word; white-space: pre-wrap;"> </pre>
    <script src="//dl.metabar.ru/static/js/ecomerce-context-sovetnik-vks.js" type="text/javascript" async=""></script>
    <iframe src="https://dl.metabar.ru/static/storage/index.html" style="display: none;"></iframe>
  </body>
</html>

rails s log是:

=> Booting Thin
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop


Started GET "/" for 127.0.0.1 at 2014-04-17 11:24:02 +0300
Processing by SomeController#index as HTML
Completed 200 OK in 262ms (Views: 0.2ms | ActiveRecord: 5.0ms)

==== 更新 ====

布局:

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
  <head>
    <meta charset="utf-8" />


    <!-- Set the viewport width to device width for mobile -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>

    <%= stylesheet_link_tag    "application" %>
    <%= javascript_include_tag "vendor/custom.modernizr" %>
    <%= csrf_meta_tags %>
  </head>

  <body>

    <%= yield %>


    <%= javascript_include_tag "application" %>
  </body>
</html>

==== 更新 ====

似乎它会呈现与render nothing: true类似的内容,因为它会呈现[" "]。 我发了egrep -R "render nothing" .但没有找到任何帮助。有什么建议吗?

render body: File.read("#{Rails.root}/app/views/some/index.html.erb")

工作正常,但这不是一个好的决定。

1 个答案:

答案 0 :(得分:0)

好的伙计们,我已经修好了。 我已经尝试了很多方法来识别和/或修复这个奇怪的错误,但没有找到它。 最后一步是

$ cd ..
$ rails new previous_app_name

并使用d diff来添加rails4错过的配置。并n跳过所有更改。 肮脏的方式,但如果你有这样的问题,并准确添加或改变线条,一切都会很好;)