3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/nested_has_many_through/association.rb', line 3
def self.included(base)
base.class_eval do
def construct_conditions
@nested_join_attributes ||= construct_nested_join_attributes
if @reflection.through_reflection && @reflection.through_reflection.macro == :belongs_to
"#{@nested_join_attributes[:remote_key]} = #{belongs_to_quoted_key} #{@nested_join_attributes[:conditions]}"
else
"#{@nested_join_attributes[:remote_key]} = #{@owner.quoted_id} #{@nested_join_attributes[:conditions]}"
end
"#{@nested_join_attributes[:remote_key]} = #{@owner.quoted_id} #{@nested_join_attributes[:conditions]}"
end
def construct_joins(custom_joins = nil)
@nested_join_attributes ||= construct_nested_join_attributes
"#{@nested_join_attributes[:joins]} #{custom_joins}"
end
end
end
|