Skip to content

Commit 891d07a

Browse files
feat(smart-field): add new options to support native polymorphic fields (#694)
1 parent 1b3ac1e commit 891d07a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/forest_liana/collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ def field(name, opts, &block)
7272
opts[:relationships] = nil unless opts.has_key?(:relationships)
7373
opts[:widget] = nil unless opts.has_key?(:widget)
7474
opts[:validations] = [] unless opts.has_key?(:validations)
75+
opts[:is_virtual] = true unless opts.has_key?(:polymorphic_key) && opts[:polymorphic_key]
7576

7677
model.fields << opts.merge({
7778
field: name,
7879
is_filterable: !!opts[:is_filterable],
7980
is_sortable: !!opts[:is_sortable],
80-
is_virtual: true
8181
})
8282

8383
define_method(name) { self.data[name] } if smart_collection?

0 commit comments

Comments
 (0)