Created
October 8, 2014 17:34
-
-
Save deevis/d44aa04201130d44d11d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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