Heroku的Rails模板错误(Rails Template Error with Heroku)

编程入门 行业动态 更新时间:2024-10-25 19:27:18
Heroku的Rails模板错误(Rails Template Error with Heroku)

当我部署到heroku时,当我尝试创建一个嵌套在蓝图中的新注释时,我抛出并出错。 我已经尝试了很多,甚至不记得这一切都写在这里。 如果我错过了一些明显的东西,请告诉我。 谢谢!

2012-12-18T00:07:26+00:00 app[web.1]: Processing by CommentsController#new as HTML 2012-12-18T00:07:26+00:00 app[web.1]: Parameters: {"blueprint_id"=>"1"} 2012-12-18T00:07:26+00:00 heroku[router]: at=info method=GET path=/blueprints/1/comments/new host=aeh.herokuapp.com fwd=68.200.131.243 dyno=web.1 queue=0 wait=0ms connect=3ms service=44ms status=500 bytes=643 2012-12-18T00:07:26+00:00 app[web.1]: Completed 500 Internal Server Error in 8ms 2012-12-18T00:07:26+00:00 app[web.1]: 2012-12-18T00:07:26+00:00 app[web.1]: app/views/comments/_form.html.erb:29:in `block in _app_views_comments__form_html_erb___740426380689644965_39997500' 2012-12-18T00:07:26+00:00 app[web.1]: 2012-12-18T00:07:26+00:00 app[web.1]: ActionView::Template::Error (undefined method `category' for #<Comment:0x00000005109730>): 2012-12-18T00:07:26+00:00 app[web.1]: 30: </div> 2012-12-18T00:07:26+00:00 app[web.1]: Rendered comments/new.html.erb within layouts/application (5.4ms) 2012-12-18T00:07:26+00:00 app[web.1]: Rendered comments/_form.html.erb (3.1ms) 2012-12-18T00:07:26+00:00 app[web.1]: 28: <div class="controls"> 2012-12-18T00:07:26+00:00 app[web.1]: 27: <%= f.label :category, :class => 'control-label' %> 2012-12-18T00:07:26+00:00 app[web.1]: app/views/comments/new.html.erb:6:in `_app_views_comments_new_html_erb___765962496684666744_33764340' 2012-12-18T00:07:26+00:00 app[web.1]: 26: <div class="control-group"> 2012-12-18T00:07:26+00:00 app[web.1]: app/views/comments/_form.html.erb:1:in `_app_views_comments__form_html_erb___740426380689644965_39997500' 2012-12-18T00:07:26+00:00 app[web.1]: 2012-12-18T00:07:26+00:00 app[web.1]: 32: 2012-12-18T00:07:26+00:00 app[web.1]: 29: <%= f.text_field :category, :class => 'text_field' %> 2012-12-18T00:07:26+00:00 app[web.1]: 31: </div> 2012-12-18T00:07:26+00:00 app[web.1]: app/controllers/comments_controller.rb:35:in `new' 2012-12-18T00:07:27+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2012-12-18T00:07:27+00:00 app[web.1]: [2012-12-18 00:07:27] ERROR SignalException: SIGTERM 2012-12-18T00:07:27+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select' 2012-12-18T00:07:28+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 46647`

_形成部分如下

<%= form_for [@blueprint, @comment], :html => { :class => 'form-horizontal' } do |f| %> <div class="control-group"> <%= f.label :comment, :class => 'control-label' %> <div class="controls"> <%= f.text_area :comment, :class => 'text_area' %> </div> </div> <div class="control-group"> <%= f.label :blueprint_id, :class => 'control-label' %> <div class="controls"> <%= f.number_field :blueprint_id, :class => 'number_field' %> </div> </div> <div class="control-group"> <%= f.label :user_id, :class => 'control-label' %> <div class="controls"> <%= f.number_field :user_id, :class => 'number_field' %> </div> </div> <div class="control-group"> <%= f.label :project_id, :class => 'control-label' %> <div class="controls"> <%= f.number_field :project_id, :class => 'number_field' %> </div> </div> <div class="control-group"> <%= f.label :category, :class => 'control-label' %> <div class="controls"> <%= f.text_field :category, :class => 'text_field' %> </div> </div> <div class="form-actions"> <%= f.submit nil, :class => 'btn btn-primary' %> <%= link_to t('.cancel', :default => t("helpers.links.cancel")), blueprint_comments_path(@blueprint), :class => 'btn' %> </div>

When I deploy to heroku, when I try to create a new comment, which is nested in blueprints, I throw and error. I have tried so much that I can't even remember it all to write it in here. Let me know if I am missing something obvious. Thanks!

2012-12-18T00:07:26+00:00 app[web.1]: Processing by CommentsController#new as HTML 2012-12-18T00:07:26+00:00 app[web.1]: Parameters: {"blueprint_id"=>"1"} 2012-12-18T00:07:26+00:00 heroku[router]: at=info method=GET path=/blueprints/1/comments/new host=aeh.herokuapp.com fwd=68.200.131.243 dyno=web.1 queue=0 wait=0ms connect=3ms service=44ms status=500 bytes=643 2012-12-18T00:07:26+00:00 app[web.1]: Completed 500 Internal Server Error in 8ms 2012-12-18T00:07:26+00:00 app[web.1]: 2012-12-18T00:07:26+00:00 app[web.1]: app/views/comments/_form.html.erb:29:in `block in _app_views_comments__form_html_erb___740426380689644965_39997500' 2012-12-18T00:07:26+00:00 app[web.1]: 2012-12-18T00:07:26+00:00 app[web.1]: ActionView::Template::Error (undefined method `category' for #<Comment:0x00000005109730>): 2012-12-18T00:07:26+00:00 app[web.1]: 30: </div> 2012-12-18T00:07:26+00:00 app[web.1]: Rendered comments/new.html.erb within layouts/application (5.4ms) 2012-12-18T00:07:26+00:00 app[web.1]: Rendered comments/_form.html.erb (3.1ms) 2012-12-18T00:07:26+00:00 app[web.1]: 28: <div class="controls"> 2012-12-18T00:07:26+00:00 app[web.1]: 27: <%= f.label :category, :class => 'control-label' %> 2012-12-18T00:07:26+00:00 app[web.1]: app/views/comments/new.html.erb:6:in `_app_views_comments_new_html_erb___765962496684666744_33764340' 2012-12-18T00:07:26+00:00 app[web.1]: 26: <div class="control-group"> 2012-12-18T00:07:26+00:00 app[web.1]: app/views/comments/_form.html.erb:1:in `_app_views_comments__form_html_erb___740426380689644965_39997500' 2012-12-18T00:07:26+00:00 app[web.1]: 2012-12-18T00:07:26+00:00 app[web.1]: 32: 2012-12-18T00:07:26+00:00 app[web.1]: 29: <%= f.text_field :category, :class => 'text_field' %> 2012-12-18T00:07:26+00:00 app[web.1]: 31: </div> 2012-12-18T00:07:26+00:00 app[web.1]: app/controllers/comments_controller.rb:35:in `new' 2012-12-18T00:07:27+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2012-12-18T00:07:27+00:00 app[web.1]: [2012-12-18 00:07:27] ERROR SignalException: SIGTERM 2012-12-18T00:07:27+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select' 2012-12-18T00:07:28+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 46647`

_form partial below

<%= form_for [@blueprint, @comment], :html => { :class => 'form-horizontal' } do |f| %> <div class="control-group"> <%= f.label :comment, :class => 'control-label' %> <div class="controls"> <%= f.text_area :comment, :class => 'text_area' %> </div> </div> <div class="control-group"> <%= f.label :blueprint_id, :class => 'control-label' %> <div class="controls"> <%= f.number_field :blueprint_id, :class => 'number_field' %> </div> </div> <div class="control-group"> <%= f.label :user_id, :class => 'control-label' %> <div class="controls"> <%= f.number_field :user_id, :class => 'number_field' %> </div> </div> <div class="control-group"> <%= f.label :project_id, :class => 'control-label' %> <div class="controls"> <%= f.number_field :project_id, :class => 'number_field' %> </div> </div> <div class="control-group"> <%= f.label :category, :class => 'control-label' %> <div class="controls"> <%= f.text_field :category, :class => 'text_field' %> </div> </div> <div class="form-actions"> <%= f.submit nil, :class => 'btn btn-primary' %> <%= link_to t('.cancel', :default => t("helpers.links.cancel")), blueprint_comments_path(@blueprint), :class => 'btn' %> </div>

最满意答案

“通过向本地端添加迁移并再次推送到heroku来修复。”

"Fixed by adding migration to local end and pushing to heroku again. "

更多推荐

本文发布于:2023-08-06 07:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1446012.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模板   错误   Rails   Heroku   Template

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!