Skip to content

Commit 5abb19f

Browse files
committed
fixed primary key identification for forms without active record model
1 parent 4214f71 commit 5abb19f

File tree

1 file changed

+5
-2
lines changed
  • lib/matestack/ui/vue_js/components/form

1 file changed

+5
-2
lines changed

lib/matestack/ui/vue_js/components/form/form.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def vue_props
5656
emit: ctx.emit,
5757
delay: ctx.delay,
5858
fields_for: ctx.fields_for,
59-
primary_key: context.for&.class&.primary_key
59+
primary_key: for_object_primary_key
6060
}
6161
end
6262

@@ -69,10 +69,13 @@ def for_option
6969
@for_option ||= ctx.for
7070
end
7171

72+
def for_object_primary_key
73+
context.for&.class&.primary_key rescue nil
74+
end
75+
7276
def form_method
7377
@form_method ||= options.delete(:method)
7478
end
75-
7679
end
7780
end
7881
end

0 commit comments

Comments
 (0)