Created
October 17, 2011 03:54
-
-
Save dbrady/1291906 to your computer and use it in GitHub Desktop.
ActiveRecord models deny their ancestry. What gives?
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
class Bonk < ActiveRecord::Base | |
end | |
Bonk.ancestors.include? ActiveRecord::Base | |
# => true | |
Bonk.is_a? ActiveRecord::Base | |
# => false | |
# um...WAT | |
# X.is_a? Y should return true if Y is a superclass of X or | |
# if Y is a module included by X. So, um... what gives? | |
# lolrails? |
Answer thanks to @jm on Twitter: Bonk.is_a? won't work, but Bonk.new.is_a? DOES. You have to use it on instances, not their classes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shame was my first guess.