lib/model_discovery/discovery.rb in model_discovery-0.2.1 vs lib/model_discovery/discovery.rb in model_discovery-0.2.2
- old
+ new
@@ -15,10 +15,10 @@
# Discover models in current rails app and load them
discover Rails.root
# Create a content type entry for all Models
ActiveRecord::Base.subclasses.each do |model|
- ApplicationModels.create(:model => model.to_s)
+ ApplicationModels.find_or_create_by_model(model.to_s)
end
end
private