lib/administrate/fields/belongs_to.rb in administrate-0.0.10 vs lib/administrate/fields/belongs_to.rb in administrate-0.0.11
- old
+ new
@@ -10,10 +10,16 @@
def permitted_attribute
self.class.permitted_attribute(attribute)
end
def candidate_records
- Object.const_get(attribute.to_s.camelcase).all
+ Object.const_get(associated_class_name).all
+ end
+
+ private
+
+ def associated_class_name
+ options.fetch(:class_name, attribute.to_s.camelcase)
end
end
end
end