I was horsing around with the reflect_on_assocation class method of
ActiveRecord Reflection, which returns an instance of
AssociationReflection. One of its methods is called active_record. I
run it in console:
I think, #reflect_on_association is a class method. So it tells you if
the
class has some association and the stuff related to that.
Account.reflect_on_association(:users) will give you some information
about
how the attribute :users is associated with the model Account. Probably,
a
has_many association, I guess.
Now, in most cases, it goes like this:
Account.reflect_on_association(:users).active_record => User
But in your case, the model Account seems to be associated with itself
through :users. It would be really helpful if you post your models here.
So, to answer your question: Can’t you just do Account.class?
Well, in this special case you could, but in most other cases, not.
Hope this helps.
Ace
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.