Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deevis/d44aa04201130d44d11d to your computer and use it in GitHub Desktop.
Save deevis/d44aa04201130d44d11d to your computer and use it in GitHub Desktop.
pyr_models = ActiveRecord::Base.subclasses.map(&:name).select{|c| c =~ /Pyr.*/}.sort
pyr_polys = {}.tap{|m| pyr_models.each{|klazz| m[klazz] = begin;obj=klazz.constantize.send(:first); app.polymorphic_path(obj) if obj;rescue Exception => e; e.message;end};nil}
pyr_models_mapped = pyr_polys.select{|k,v| v =~ /\/.*/}.keys
# Those without polymorphic paths
(pyr_models - pyr_models_mapped).sort.each {|m| puts m}
# Those with polymorphic paths
pyr_models_mapped.sort.each {|m| puts m}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment