Guest User

blad stronka

a guest
Feb 20th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.91 KB | None | 0 0
  1. pierwsz plik
  2.  
  3. class AnswersController < ApplicationController
  4.   # GET /answers
  5.   # GET /answers.json
  6.  
  7.   before_filter :get_tweet
  8.  
  9.   def get_tweet
  10.     @tweet = Tweet.find(params[:tweet_id])
  11.   end
  12.  
  13.   def index
  14.     @answers = @tweet.answers
  15.  
  16.     respond_to do |format|
  17.       format.html # index.html.erb
  18.       format.json { render json: @answers }
  19.     end
  20.   end
  21.  
  22. .
  23. .
  24. .
  25.  
  26. drugi plik
  27.  
  28. <h1>Listing answers</h1>
  29.  
  30. <table>
  31.   <tr>
  32.     <th>Status</th>
  33.     <th></th>
  34.     <th></th>
  35.     <th></th>
  36.   </tr>
  37.  
  38. <% @answers.each do |answer| %>
  39.   <tr>
  40.     <td><%= answer.body %></td>
  41.     <td><%= link_to 'Show', answer %></td>
  42.     <td><%= link_to 'Edit', edit_tweet_answer_path(@tweet, answer) %></td>
  43.     <td><%= link_to 'Destroy', [@tweet, answer], method: :delete, data: { confirm: 'Are you sure?' } %></td>
  44.   </tr>
  45. <% end %>
  46. </table>
  47.  
  48. <br />
  49.  
  50. <%= link_to 'New Answer', new_tweet_answer_path(@tweet) %>
  51.  
  52.  
  53. ekran bledu:
  54.  
  55. ActiveRecord::StatementInvalid in Answers#index
  56.  
  57. Showing /Users/porque/Documents/rails/anonimsblog/app/views/answers/index.html.erb where line #11 raised:
  58.  
  59. PG::Error: ERROR:  column answers.tweet_id does not exist
  60. LINE 1: SELECT "answers".* FROM "answers"  WHERE "answers"."tweet_id...
  61.                                                  ^
  62. : SELECT "answers".* FROM "answers"  WHERE "answers"."tweet_id" = 7
  63. Extracted source (around line #11):
  64.  
  65. 8:     <th></th>
  66. 9:   </tr>
  67. 10:
  68. 11: <% @answers.each do |answer| %>
  69. 12:   <tr>
  70. 13:     <td><%= answer.body %></td>
  71. 14:     <td><%= link_to 'Show', answer %></td>
  72. Rails.root: /Users/porque/Documents/rails/anonimsblog
  73.  
  74. Application Trace | Framework Trace | Full Trace
  75. app/views/answers/index.html.erb:11:in `_app_views_answers_index_html_erb___3715999052549579919_70208881241740'
  76. app/controllers/answers_controller.rb:14:in `index'
  77. Request
  78.  
  79. Parameters:
  80.  
  81. {"tweet_id"=>"7"}
  82. Show session dump
  83.  
  84. Show env dump
  85.  
  86. Response
  87.  
  88. Headers:
  89.  
  90. None
Advertisement
Add Comment
Please, Sign In to add comment