Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Getting unknown attribute error #18

Open
charliemagee opened this issue Jun 2, 2012 · 0 comments
Open

Getting unknown attribute error #18

charliemagee opened this issue Jun 2, 2012 · 0 comments

Comments

@charliemagee
Copy link

I've got a real basic Question and Answer project I'm trying to do. I can add answers to my question but as soon as I try to Create Question I get this error:

ActiveRecord::UnknownAttributeError in QuestionsController#create
unknown attribute: question_id

app/controllers/questions_controller.rb:44:in new' app/controllers/questions_controller.rb:44:increate'

The "problem" sections of my controller:

def new
@question = Question.new

respond_to do |format|
  format.html # new.html.erb
  format.json { render json: @question }
end

end

def create
@question = Question.new(params[:question])

respond_to do |format|
  if @question.save
    format.html { redirect_to @question, notice: 'Question was successfully created.' }
    format.json { render json: @question, status: :created, location: @question }
  else
    format.html { render action: "new" }
    format.json { render json: @question.errors, status: :unprocessable_entity }
  end
end

end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant