end
def includes
- @owner_model ? {@owner_model.item_name => {}} : {}
+ if @owner_model
+ if @owner_model.owner_model
+ {@owner_model.item_name => {@owner_model.owner_model.item_name => {}}}
+ else
+ {@owner_model.item_name => {}}
+ end
+ else
+ {}
+ end
end
def order
when :artist
operator = @operators.artist
end
- t = @owner_model ? @owner_table_name : @table_name
+ t = if @owner_model
+ if @owner_model.owner_model
+ @owner_model.owner_model.table_name
+ else
+ @owner_model.table_name
+ end
+ else
+ @table_name
+ end
[t + '.' + @model.owner_type.to_s + '_id = ?', operator.id]
end
-
end
class HasManyList < BaseList