lib/custom_fields/target.rb in custom_fields-2.3.1 vs lib/custom_fields/target.rb in custom_fields-2.3.2
- old
+ new
@@ -71,9 +71,11 @@
# @param [ Hash ] recipe The recipe describing the fields to add
#
# @return [ Class ] the custom klass
#
def klass_with_custom_fields(recipe)
+ return self if recipe.blank? # no recipe provided
+
name = recipe['name']
(modules = self.name.split('::')).pop
parent = modules.empty? ? Object : modules.join('::').constantize