Im running into a small (newbie) problem.
I've got 2 models: question & reviews.
Reviews schema: question_id, user_id, rating, comments
On the 'show' view, i've integrated the following form (formtastic):
- semantic_form_for @question.reviews.build do |f|
= f.error_messages
= f.input :rating
= f.input :comments
= f.buttons
My reviews controller's create action looks like this:
def create
@review = Review.new(params[:review])
@review.user_id = current_user.id
if @review.save
flash[:notice] = "Successfully created review."
redirect_to(@review.question)
else
redirect_to(@review.question)
end
end
However, now it simply doesnt seem to save the question id in the question_id field. It does save the user_id nicely.
Does anyone have a clue of what Im doing wrong? If you need logs, let me know! Thanks in advance