Я использую Rails 5.0.0. У меня есть эта модельКак мне присвоить поле own_to необязательно?
class Scenario < ApplicationRecord
belongs_to :grading_rubric
has_many :confidential_memo
end
но когда я призываю мой создать метод для модели, она не
def create
@scenario = Scenario.new(scenario_params)
respond_to do |format|
if @scenario.save
puts "saved successfully."
format.html { redirect_to confidential_memo_path(@scenario), notice: 'Saved successfully.' }
else
puts "full messages: #{@scenario.errors.full_messages}"
format.html { render action: "show" }
end
end
end
Ошибки я получаю
full messages: ["Grading rubric must exist"]
Как показывают, что belongs_to аргумент должен быть факультативным (то есть разрешенным для null)?