Class: ActiveRecord::Base

Inherits:
Object show all
Defined in:
lib/fake_arel/selectable_includes.rb

Overview

Politely lifted from fcheung’s selectable_includes plugin for ActiveRecord github.com/fcheung/selectable_includes/blob/master/lib/selectable_includes.rb

Class Method Summary collapse

Class Method Details

.construct_finder_sql_with_included_associations_with_selectable_includes(options, join_dependency) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/fake_arel/selectable_includes.rb', line 5

def construct_finder_sql_with_included_associations_with_selectable_includes(options, join_dependency)
  scope = scope(:find)
  select_options = options[:select] || (scope && scope[:select])
  sql = construct_finder_sql_with_included_associations_without_selectable_includes(options, join_dependency)
  unless select_options.blank?
    sql.sub!(/\ASELECT /, "SELECT #{select_options}, ")
  end
  sql
end