Module: ActiveRecord::Reflection::AssociationReflection::HasCount
- Included in:
- ActiveRecord::Reflection::AssociationReflection
- Defined in:
- lib/active_record/reflection/has_count.rb
Instance Method Summary collapse
- #association_class_with_has_count ⇒ Object
- #klass_with_has_count ⇒ Object
- #name_without_count ⇒ Object
Instance Method Details
#association_class_with_has_count ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/active_record/reflection/has_count.rb', line 29 def association_class_with_has_count case macro when :has_count ActiveRecord::Associations::HasCount else association_class_without_has_count end end |
#klass_with_has_count ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/active_record/reflection/has_count.rb', line 16 def klass_with_has_count case macro when :has_count @klass ||= active_record.send(:compute_type, [:class_name] || name_without_count.singularize.classify) else klass_without_has_count end end |
#name_without_count ⇒ Object
25 26 27 |
# File 'lib/active_record/reflection/has_count.rb', line 25 def name_without_count name.to_s.sub(/_count$/, "") end |