class Millstone::ActiveRecord::Associations::HasManyThroughWithoutDeletedAssociation

Public Instance Methods

construct_conditions() click to toggle source
Calls superclass method
# File lib/millstone/active_record/associations/has_many_through_without_deleted_association.rb, line 5
def construct_conditions
  return super unless @reflection.through_reflection.klass.as_millstone?

  table_name = @reflection.through_reflection.quoted_table_name
  conditions = construct_quoted_owner_attributes(@reflection.through_reflection).map do |attr, value|
    "#{table_name}.#{attr} = #{value}"
  end
  conditions << @reflection.through_reflection.klass.millstone_without_deleted_conditions
  conditions << sql_conditions if sql_conditions
  "(" + conditions.join(') AND (') + ")"
end