lib/railroady/models_diagram.rb in railroady-1.4.2 vs lib/railroady/models_diagram.rb in railroady-1.5.0

- old
+ new

@@ -37,30 +37,30 @@ end def engine_files engines.collect { |engine| Dir.glob("#{engine.root}/app/models/**/*.rb") }.flatten end - + def extract_class_name(filename) filename_was, class_name = filename, nil - - filename = "app/models/#{filename.split('app/models')[1]}" - + + filename = "app/models/#{filename.split('app/models')[1]}" + while filename.split('/').length > 2 begin class_name = filename.match(/.*\/models\/(.*).rb$/)[1].camelize class_name.constantize - + break - rescue Exception => e + rescue Exception # => e class_name = nil filename_end = filename.split('/')[2..-1] filename_end.shift filename = "#{filename.split('/')[0, 2].join('/')}/#{filename_end.join('/')}" end end - + if class_name.nil? filename_was.match(/.*\/models\/(.*).rb$/)[1].camelize else class_name end @@ -90,11 +90,11 @@ end end # process_class def include_inheritance?(current_class) STDERR.puts current_class.superclass if @options.verbose - (defined?(ActiveRecord::Base) && current_class.superclass != ActiveRecord::Base) || - (defined?(CouchRest::Model::Base) && current_class.superclass != CouchRest::Model::Base) || + (defined?(ActiveRecord::Base) ? current_class.superclass != ActiveRecord::Base : true) && + (defined?(CouchRest::Model::Base) ? current_class.superclass != CouchRest::Model::Base : true) && (current_class.superclass != Object) end def process_basic_class(current_class) node_type = @options.brief ? 'class-brief' : 'class'