lib/railroady/models_diagram.rb in railroady-1.0.1 vs lib/railroady/models_diagram.rb in railroady-1.0.2

- old
+ new

@@ -127,14 +127,15 @@ assoc_name = '' else assoc_name = assoc.name.to_s end - # Patch from "alpack" to support classes in a non-root module namespace. See: http://disq.us/yxl1v - if class_name.include?("::") && !assoc_class_name.include?("::") - assoc_class_name = class_name.split("::")[0..-2].push(assoc_class_name).join("::") - end - + # Patch from "alpack" to support classes in a non-root module namespace. See: http://disq.us/yxl1v + if class_name.include?("::") && !assoc_class_name.include?("::") + assoc_class_name = class_name.split("::")[0..-2].push(assoc_class_name).join("::") + end + assoc_class_name.gsub!(%r{^::}, '') + if ['has_one', 'belongs_to'].include? assoc.macro.to_s assoc_type = 'one-one' elsif assoc.macro.to_s == 'has_many' && (! assoc.options[:through]) assoc_type = 'one-many' else # habtm or has_many, :through