I have two Active Record Models
class User < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecordd:Base
end
user.posts.get_object_class
user.posts.class.to_s
# Post::ActiveRecord_Associations_CollectionProxy
Use model
or klass
attribute - it will return the constant you are looking for:
user.posts.model
#=> Post
user.posts.klass
#=> Post
See apidocs for more details.