lib/avo/fields/belongs_to_field.rb in avo-1.22.1 vs lib/avo/fields/belongs_to_field.rb in avo-1.22.2
- old
+ new
@@ -134,10 +134,12 @@
end
end
def is_polymorphic?
polymorphic_as.present?
+ rescue
+ false
end
def foreign_key
return polymorphic_as if polymorphic_as.present?
@@ -148,9 +150,16 @@
end
end
def reflection_for_key(key)
get_model_class(get_model).reflections[key.to_s]
+ rescue
+ nil
+ end
+
+ # Get the model reflection instance
+ def reflection
+ reflection_for_key(id)
rescue
nil
end
def relation_model_class