I have a model A that has a \"has_many\" association to another model B. I have a business requirement that an insert into A requires at least 1 associated record to B. Is
If you want to ensure that the association is both present and guaranteed to be valid, you also need to use
class Transaction < ActiveRecord::Base belongs_to :bank validates_associated :bank validates :bank, presence: true end