Module: ArV3Patch
- Included in:
- ActiveRecord::Associations::Preloader
- Defined in:
- lib/kashmir/patches/active_record.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
37 38 39 40 41 |
# File 'lib/kashmir/patches/active_record.rb', line 37 def self.included(klass) klass.instance_eval do remove_method :records_by_reflection end end |
Instance Method Details
#records_by_reflection(association) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/kashmir/patches/active_record.rb', line 43 def records_by_reflection(association) grouped = records.group_by do |record| reflection = record.class.reflections[association] unless reflection next end reflection end ## This takes out the unexisting relations grouped.delete(nil) grouped end |