在Heroku上运行应用程序时ActionView :: Template :: Error

时间:2014-07-28 23:38:01

标签: ruby-on-rails heroku

我刚刚向Heroku部署了一个Rails 4.1.1应用程序。资产是预编译的,我运行了heroku run rake:migrate。我得到了"我们很抱歉,但出了点问题。"尝试创建新事件时出错。这是日志:

2014-07-28T23:23:48.822461+00:00 app[web.1]: Started GET "/events/new" for 122.164.16.99 at 2014-07-28 23:23:48 +0000
2014-07-28T23:23:48.848909+00:00 app[web.1]: ActionView::Template::Error (only generation of JSON objects or arrays allowed):
2014-07-28T23:23:48.848911+00:00 app[web.1]:     44:   <%= f.hidden_field :longitude %>
2014-07-28T23:23:48.846787+00:00 app[web.1]:   Rendered events/new.html.erb within layouts/application (19.5ms)
2014-07-28T23:23:48.848921+00:00 app[web.1]:     46: <% end %>
2014-07-28T23:23:48.848923+00:00 app[web.1]:     47: <%= tinymce %>
2014-07-28T23:23:48.848925+00:00 app[web.1]:   app/views/events/new.html.erb:47:in `_app_views_events_new_html_erb__1200657879697357905_70177202752440'
2014-07-28T23:23:48.848927+00:00 app[web.1]:
2014-07-28T23:23:48.826075+00:00 app[web.1]: Processing by EventsController#new as HTML
2014-07-28T23:25:57.976023+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by justin@stravarius.com
2014-07-28T23:26:09.499054+00:00 heroku[run.6390]: Starting process with command `bundle exec rake db:migrate`
2014-07-28T23:26:09.467357+00:00 heroku[run.6390]: Awaiting client
2014-07-28T23:26:09.672949+00:00 heroku[run.6390]: State changed from starting to up
2014-07-28T23:26:18.617166+00:00 heroku[run.6390]: State changed from up to complete
2014-07-28T23:26:18.604806+00:00 heroku[run.6390]: Process exited with status 0
2014-07-28T23:26:29.526172+00:00 heroku[web.1]: State changed from up to starting
2014-07-28T23:26:33.389916+00:00 app[web.1]: Exiting
2014-07-28T23:26:35.518012+00:00 app[web.1]: => Booting Thin
2014-07-28T23:26:35.518036+00:00 app[web.1]: => Rails 4.1.1 application starting in production on http://0.0.0.0:12167
2014-07-28T23:26:35.518057+00:00 app[web.1]: Thin web server (v1.6.2 codename Doc Brown)
2014-07-28T23:26:35.518038+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-07-28T23:26:35.518040+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2014-07-28T23:26:35.518054+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-07-28T23:26:35.518065+00:00 app[web.1]: Listening on 0.0.0.0:12167, CTRL+C to stop
2014-07-28T23:26:35.518064+00:00 app[web.1]: Maximum connections set to 1024
2014-07-28T23:26:35.580716+00:00 heroku[web.1]: State changed from starting to up
2014-07-28T23:26:32.387083+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 12167 -e production`
2014-07-28T23:26:32.645709+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-07-28T23:26:34.775096+00:00 heroku[web.1]: Process exited with status 0
2014-07-28T23:26:39.352046+00:00 heroku[router]: at=info method=GET path="/" host=ticketfire.herokuapp.com request_id=a2338d90-19d8-4e1b-9657-19d849841872 fwd="122.164.16.99" dyno=web.1 connect=1 service=110 status=304 bytes=968
2014-07-28T23:26:39.351315+00:00 app[web.1]:   Rendered events/index.html.erb within layouts/application (4.2ms)
2014-07-28T23:26:39.249472+00:00 app[web.1]: Started GET "/" for 122.164.16.99 at 2014-07-28 23:26:39 +0000
2014-07-28T23:26:39.322598+00:00 app[web.1]: Processing by EventsController#index as HTML
2014-07-28T23:26:39.353229+00:00 app[web.1]: Completed 200 OK in 31ms (Views: 5.9ms | ActiveRecord: 2.1ms)
2014-07-28T23:26:39.902983+00:00 heroku[router]: at=info method=GET path="/assets/application-cd31d02bfc154165a0af812b7ff6e596.js" host=ticketfire.herokuapp.com request_id=a61f70c2-42d4-4ad6-97dd-717849d1cc8c fwd="122.164.16.99" dyno=web.1 connect=1 service=2 status=304 bytes=1013
2014-07-28T23:26:39.916377+00:00 heroku[router]: at=info method=GET path="/assets/application-0c6844a60e2e3d6e557c678587615eb2.css" host=ticketfire.herokuapp.com request_id=d85591b4-27b5-4fc4-9335-8cf27d4f21fd fwd="122.164.16.99" dyno=web.1 connect=2 service=3 status=304 bytes=1029
2014-07-28T23:26:41.133222+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=ticketfire.herokuapp.com request_id=8705d641-7537-4596-898c-13f8f6aa2ba1 fwd="122.164.16.99" dyno=web.1 connect=1 service=2 status=304 bytes=907
2014-07-28T23:26:42.861209+00:00 app[web.1]: Processing by EventsController#new as HTML
2014-07-28T23:26:42.855070+00:00 app[web.1]: Started GET "/events/new" for 122.164.16.99 at 2014-07-28 23:26:42 +0000
2014-07-28T23:26:43.375383+00:00 heroku[router]: at=info method=GET path="/events/new" host=ticketfire.herokuapp.com request_id=1a2c8d76-d676-4db7-afc1-5eb1b0b96340 fwd="122.164.16.99" dyno=web.1 connect=1 service=522 status=500 bytes=1004
2014-07-28T23:26:43.373690+00:00 app[web.1]:     44:   <%= f.hidden_field :longitude %>
2014-07-28T23:26:43.373694+00:00 app[web.1]:     46: <% end %>
2014-07-28T23:26:43.373695+00:00 app[web.1]:     47: <%= tinymce %>
2014-07-28T23:26:43.373699+00:00 app[web.1]:
2014-07-28T23:26:43.373689+00:00 app[web.1]: ActionView::Template::Error (only generation of JSON objects or arrays allowed):
2014-07-28T23:26:43.373692+00:00 app[web.1]:     45:   <%= f.submit "Create Event", class: "btn btn-primary" %>
2014-07-28T23:26:43.373697+00:00 app[web.1]:   app/views/events/new.html.erb:47:in `_app_views_events_new_html_erb__2347545824640057671_69913027696180'
2014-07-28T23:26:43.371222+00:00 app[web.1]:   Rendered events/new.html.erb within layouts/application (496.6ms)
2014-07-28T23:26:43.373685+00:00 app[web.1]:
2014-07-28T23:26:43.371387+00:00 app[web.1]: Completed 500 Internal Server Error in 510ms
2014-07-28T23:26:43.373698+00:00 app[web.1]:
2014-07-28T23:26:43.874986+00:00 heroku[router]: at=info method=GET path="/events/new" host=ticketfire.herokuapp.com request_id=39a0d0da-bef1-4469-9c67-4c7c17f62f40 fwd="122.164.16.99" dyno=web.1 connect=55 service=33 status=500 bytes=981
2014-07-28T23:26:43.877096+00:00 app[web.1]:     46: <% end %>
2014-07-28T23:26:43.877132+00:00 app[web.1]:   app/views/events/new.html.erb:47:in `_app_views_events_new_html_erb__2347545824640057671_69913043022460'
2014-07-28T23:26:43.850054+00:00 app[web.1]: Processing by EventsController#new as HTML
2014-07-28T23:26:43.874849+00:00 app[web.1]: Completed 500 Internal Server Error in 25ms
2014-07-28T23:26:43.877093+00:00 app[web.1]:     44:   <%= f.hidden_field :longitude %>
2014-07-28T23:26:43.874712+00:00 app[web.1]:   Rendered events/new.html.erb within layouts/application (22.5ms)
2014-07-28T23:26:43.877098+00:00 app[web.1]:     47: <%= tinymce %>
2014-07-28T23:26:43.877088+00:00 app[web.1]:
2014-07-28T23:26:43.847101+00:00 app[web.1]: Started GET "/events/new" for 122.164.16.99 at 2014-07-28 23:26:43 +0000
2014-07-28T23:26:43.877133+00:00 app[web.1]:
2014-07-28T23:26:43.877095+00:00 app[web.1]:     45:   <%= f.submit "Create Event", class: "btn btn-primary" %>
2014-07-28T23:26:43.877091+00:00 app[web.1]: ActionView::Template::Error (only generation of JSON objects or arrays allowed):
2014-07-28T23:26:43.877135+00:00 app[web.1]:
2014-07-28T23:29:22.699712+00:00 heroku[router]: at=info method=GET path="/" host=ticketfire.herokuapp.com request_id=036675e8-4570-4617-bfba-226dd142163b fwd="122.164.16.99" dyno=web.1 connect=1 service=9 status=304 bytes=968
2014-07-28T23:29:22.698899+00:00 app[web.1]:   Rendered events/index.html.erb within layouts/application (1.9ms)
2014-07-28T23:29:22.699701+00:00 app[web.1]: Completed 200 OK in 4ms (Views: 1.9ms | ActiveRecord: 1.1ms)
2014-07-28T23:29:22.695833+00:00 app[web.1]: Processing by EventsController#index as HTML
2014-07-28T23:29:23.275717+00:00 heroku[router]: at=info method=GET path="/assets/application-cd31d02bfc154165a0af812b7ff6e596.js" host=ticketfire.herokuapp.com request_id=e1dfd598-5131-4c5c-8f9e-d73edcd6723e fwd="122.164.16.99" dyno=web.1 connect=1 service=1 status=304 bytes=1013
2014-07-28T23:29:22.693722+00:00 app[web.1]: Started GET "/" for 122.164.16.99 at 2014-07-28 23:29:22 +0000
2014-07-28T23:29:23.266710+00:00 heroku[router]: at=info method=GET path="/assets/application-0c6844a60e2e3d6e557c678587615eb2.css" host=ticketfire.herokuapp.com request_id=67fa0e91-e305-4985-aae2-bb1651a36e62 fwd="122.164.16.99" dyno=web.1 connect=2 service=2 status=304 bytes=1029
2014-07-28T23:29:24.062731+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=ticketfire.herokuapp.com request_id=b9610cfe-a762-48e1-a73b-e96c56b5123b fwd="122.164.16.99" dyno=web.1 connect=1 service=1 status=304 bytes=907
2014-07-28T23:29:25.503402+00:00 heroku[router]: at=info method=GET path="/events/new" host=ticketfire.herokuapp.com request_id=332b9b2f-e963-4de3-852c-4f38b297928e fwd="122.164.16.99" dyno=web.1 connect=1 service=29 status=500 bytes=1004
2014-07-28T23:29:25.477632+00:00 app[web.1]: Processing by EventsController#new as HTML
2014-07-28T23:29:25.475226+00:00 app[web.1]: Started GET "/events/new" for 122.164.16.99 at 2014-07-28 23:29:25 +0000
2014-07-28T23:29:25.500070+00:00 app[web.1]:
2014-07-28T23:29:25.500061+00:00 app[web.1]:     44:   <%= f.hidden_field :longitude %>
2014-07-28T23:29:25.500064+00:00 app[web.1]:     46: <% end %>
2014-07-28T23:29:25.500068+00:00 app[web.1]:   app/views/events/new.html.erb:47:in `_app_views_events_new_html_erb__2347545824640057671_69913027696180'
2014-07-28T23:29:25.500066+00:00 app[web.1]:     47: <%= tinymce %>
2014-07-28T23:29:25.498072+00:00 app[web.1]:   Rendered events/new.html.erb within layouts/application (19.2ms)
2014-07-28T23:29:25.498156+00:00 app[web.1]: Completed 500 Internal Server Error in 20ms
2014-07-28T23:29:25.500055+00:00 app[web.1]:
2014-07-28T23:29:25.500059+00:00 app[web.1]: ActionView::Template::Error (only generation of JSON objects or arrays allowed):
2014-07-28T23:29:25.500062+00:00 app[web.1]:     45:   <%= f.submit "Create Event", class: "btn btn-primary" %>
2014-07-28T23:29:25.500069+00:00 app[web.1]:
2014-07-28T23:29:25.839415+00:00 heroku[router]: at=info method=GET path="/events/new" host=ticketfire.herokuapp.com request_id=ecd78797-6a79-4e02-ad52-e2ad45abfc0c fwd="122.164.16.99" dyno=web.1 connect=1 service=38 status=500 bytes=980
2014-07-28T23:29:25.826942+00:00 app[web.1]:   Rendered events/new.html.erb within layouts/application (20.2ms)
2014-07-28T23:29:25.803235+00:00 app[web.1]: Started GET "/events/new" for 122.164.16.99 at 2014-07-28 23:29:25 +0000
2014-07-28T23:29:25.827018+00:00 app[web.1]: Completed 500 Internal Server Error in 21ms
2014-07-28T23:29:25.829049+00:00 app[web.1]:     45:   <%= f.submit "Create Event", class: "btn btn-primary" %>
2014-07-28T23:29:25.829046+00:00 app[web.1]: ActionView::Template::Error (only generation of JSON objects or arrays allowed):
2014-07-28T23:29:25.829043+00:00 app[web.1]:
2014-07-28T23:29:25.829054+00:00 app[web.1]:   app/views/events/new.html.erb:47:in `_app_views_events_new_html_erb__2347545824640057671_69913043022460'
2014-07-28T23:29:25.829047+00:00 app[web.1]:     44:   <%= f.hidden_field :longitude %>
2014-07-28T23:29:25.829055+00:00 app[web.1]:
2014-07-28T23:29:25.829050+00:00 app[web.1]:     46: <% end %>
2014-07-28T23:29:25.829052+00:00 app[web.1]:     47: <%= tinymce %>
2014-07-28T23:29:25.829057+00:00 app[web.1]:
2014-07-28T23:29:25.805539+00:00 app[web.1]: Processing by EventsController#new as HTML

新的活动页面如下:

<h2>Create an Event</h2>
<%= tinymce_assets %>
<%= form_for (@event) do |f| %>
    <% if @event.errors.any? %>
  <div id="error_explanation">
    <h2><%= pluralize(@event.errors.count, "error") %> prohibited
      this event from being saved:</h2>
    <ul>
    <% @event.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
  <% end %>
<div class="form-group">
  <%= f.label :name %>
  <%= f.text_field :name, class: "form-control" %>
</div>
<div class="form-group">
  <%= f.label :about %>
  <%= f.text_area :about, class: "tinymce" %>
</div>
<div class="dropdown">
  <%= f.label :time_zone %>
  <%= f.time_zone_select :time_zone, nil, {}, {class: "btn btn-default dropdown-toggle"} %>
</div>
<div class="form-group">
  <%= f.label :start_date %>
  <%= f.datetime_select :start_date %>
</div>
<div class="form-group">
  <%= f.label :end_date %>
  <%= f.datetime_select :end_date %>
</div>
<div class="form-group">
  <%= f.label :location %>
  <%= f.text_field :location, class: "form-control" %>
</div>
<div class="form-group">
  <%= f.label :contact_info %>
  <%= f.text_area :contact_info, class: "form-control" %>
</div>
  <%= f.hidden_field :latitude %>
  <%= f.hidden_field :longitude %>
  <%= f.submit "Create Event", class: "btn btn-primary" %>
<% end %>
<%= tinymce %>

有人能告诉我为什么ActionView :: Template :: Error(只允许生成JSON对象或数组)?

1 个答案:

答案 0 :(得分:0)

看起来我在部署之前混合了两个不同的Rails 3和Rails 4资产预编译教程。我不得不禁用TinyMCE来解决此错误并部署应用程序。