Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pierwsz plik
- class AnswersController < ApplicationController
- # GET /answers
- # GET /answers.json
- before_filter :get_tweet
- def get_tweet
- @tweet = Tweet.find(params[:tweet_id])
- end
- def index
- @answers = @tweet.answers
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @answers }
- end
- end
- .
- .
- .
- drugi plik
- <h1>Listing answers</h1>
- <table>
- <tr>
- <th>Status</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- <% @answers.each do |answer| %>
- <tr>
- <td><%= answer.body %></td>
- <td><%= link_to 'Show', answer %></td>
- <td><%= link_to 'Edit', edit_tweet_answer_path(@tweet, answer) %></td>
- <td><%= link_to 'Destroy', [@tweet, answer], method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </table>
- <br />
- <%= link_to 'New Answer', new_tweet_answer_path(@tweet) %>
- ekran bledu:
- ActiveRecord::StatementInvalid in Answers#index
- Showing /Users/porque/Documents/rails/anonimsblog/app/views/answers/index.html.erb where line #11 raised:
- PG::Error: ERROR: column answers.tweet_id does not exist
- LINE 1: SELECT "answers".* FROM "answers" WHERE "answers"."tweet_id...
- ^
- : SELECT "answers".* FROM "answers" WHERE "answers"."tweet_id" = 7
- Extracted source (around line #11):
- 8: <th></th>
- 9: </tr>
- 10:
- 11: <% @answers.each do |answer| %>
- 12: <tr>
- 13: <td><%= answer.body %></td>
- 14: <td><%= link_to 'Show', answer %></td>
- Rails.root: /Users/porque/Documents/rails/anonimsblog
- Application Trace | Framework Trace | Full Trace
- app/views/answers/index.html.erb:11:in `_app_views_answers_index_html_erb___3715999052549579919_70208881241740'
- app/controllers/answers_controller.rb:14:in `index'
- Request
- Parameters:
- {"tweet_id"=>"7"}
- Show session dump
- Show env dump
- Response
- Headers:
- None
Advertisement
Add Comment
Please, Sign In to add comment