awesome_nested_fields icon indicating copy to clipboard operation
awesome_nested_fields copied to clipboard

Getting unknown attribute error

Open charliemagee opened this issue 12 years ago • 0 comments

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

charliemagee avatar Jun 02 '12 18:06 charliemagee