Module: Mcmire::ArAttrLazy::HabtmExt

Defined in:
lib/mcmire/ar_attr_lazy/habtm_ext.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



4
5
6
7
8
# File 'lib/mcmire/ar_attr_lazy/habtm_ext.rb', line 4

def self.included(includer)
  includer.instance_eval do
    alias_method_chain :construct_find_options!, :attr_lazy
  end
end

Instance Method Details

#construct_find_options_with_attr_lazy!(options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/mcmire/ar_attr_lazy/habtm_ext.rb', line 10

def construct_find_options_with_attr_lazy!(options)
  # Select unlazy_column_list by default
  options[:select] ||= @reflection.options[:select]
  options[:select] ||= @reflection.klass.unlazy_column_list if @reflection.klass.respond_to?(:unlazy_column_list)
  options[:select] ||= '*'
  construct_find_options_without_attr_lazy!(options)
end