Exception: Granite::Form::UndefinedPrimaryAttribute

Inherits:
Error
  • Object
show all
Defined in:
lib/granite/form/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass, association_name) ⇒ UndefinedPrimaryAttribute

Returns a new instance of UndefinedPrimaryAttribute.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/granite/form/errors.rb', line 43

def initialize(klass, association_name)
  super(<<~MESSAGE)
    Undefined primary attribute for `#{association_name}` in #{klass}.
    It is required for embeds_many nested attributes proper operation.
    You can define this association as:

      embeds_many :#{association_name} do
        primary :attribute_name
      end
  MESSAGE
end