I have a form to collect information about a Physician. Each Physician can have at least one Address but it's ok for a physician not to have any address.
Below is the relevant code from my physician.rb and model.rb files that define the respective models.
class Physician < ApplicationRecord
belongs_to :address, optional: true
accepts_nested_attributes_for :address
class Address < ApplicationRecord
validates :line_1, presence: true
validates :city, presence: true
Address has some required fields, line_1, and city
I would like to ignore the presence requirement on these fields ONLY for the Physician form.
I tried using the optional: true tag (shown in the code above) but that didn't do it.