Created
August 31, 2012 21:48
-
-
Save n00ge/3559604 to your computer and use it in GitHub Desktop.
Describe classes (output associations and attributes)
This file contains hidden or 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
[ClassName].each do |object| | |
puts "#{object.name} (" | |
puts "\t# associations" | |
reflections = object.reflect_on_all_associations | |
reflections.each do |reflection| | |
puts "\t#{reflection.macro} => #{reflection.name.to_s.classify}" | |
end | |
puts "" | |
puts "\t# attributes" | |
object.new.attributes.each do |attribute| | |
puts "\t#{attribute[0]}" | |
end | |
puts ")" | |
puts "" | |
puts "" | |
end;nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment