lib/primer/forms/base.rb in primer_view_components-0.0.86 vs lib/primer/forms/base.rb in primer_view_components-0.0.87
- old
+ new
@@ -15,9 +15,14 @@
def form(&block)
@__vcf_form_block = block
end
def new(builder, **options)
+ if builder && !builder.is_a?(Primer::Forms::Builder)
+ raise ArgumentError, "please pass an instance of Primer::Forms::Builder when "\
+ "constructing a form object (consider using the `primer_form_with` helper)"
+ end
+
allocate.tap do |form|
form.instance_variable_set(:@builder, builder)
form.send(:initialize, **options)
end
end