I am stumped about this. In a previous commit my forms to submit new records for a particular model worked perfectly, but I must have done something along the way that messed it up because now my controller just renders the 'new' action whenever I submit a form.
The validations are all passing, but for some reason the records are not saving.
I did not write tests during development, which I am regretting now as I am going back and writing them.
But since I am new to rails, I just want to ask about what is the best way to debug this. I've tried looking at my local server log but it does not offer anything helpful. My controller's create action is below:
def create
@product = Product.find(params[:product_id])
@review = @product.reviews.new(params[:review])
current_user.reviews << @review
if @review.save
flash[:notice] = "Successfully created review."
redirect_to current_user
else
render :action => 'new'
end
end
Apologize is this is super vague (I will delete the question if it is)
Also just to note, none of my models are saving now so it seems like an application-wide issue since they were all working at an earlier commit.
@product.saveinstead of@review.save