У меня все еще есть следующая ошибка: я хочу удалить вопрос, но я получаю это:
ActiveRecord::StatementInvalid (Mysql::Error: Cannot delete or update a parent row: a foreign key constraint fails (`survey_development`.`inquiries`, CONSTRAINT `inquiries_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`)): DELETE FROM `questions` WHERE `id` = 217):
мой контроллер
def destroy
# @question.destroy
# head :ok
# @question = Question.find(params[:id])
@question.destroy
head :ok
end
модель
class Question < ActiveRecord::Base
has_one :answer, :through => :inquiry , :dependent => :destroy
belongs_to :inquiry , :dependent => :destroy
validates_presence_of :text, :message => "ERROR!"
end
Я застрял с этим: (