module ActiveRecord::HasCount::Model::ClassMethods
Private Instance Methods
has_count(name, scope = nil, options = {}, &extension)
click to toggle source
# File lib/activerecord-has_count/model.rb, line 13 def has_count(name, scope = nil, options = {}, &extension) name_with_count = :"#{name}_count" reflection = ActiveRecord::Associations::Builder::HasCount. build(self, name_with_count, scope, options, &extension) ActiveRecord::Reflection.add_reflection(self, name_with_count, reflection) end