Determining an association type

I'd like to know if an association is a has_many, belongs_to, or has_one. I was hoping I could do something like this:

company.sites.is_a? ActiveRecord::Associations::HasManyAssociation

however that doesn't work, it says that sites is just an array. Anyone know how I can determine what kind of association I'm working with?


=== works for this ActiveRecord::Associations::HasManyAssociation === company.sites


There's API for that:

   Company.reflect_on_association(:sites).macro == :has_many

-- fxn