Skip to content

Instantly share code, notes, and snippets.

@dnsilva
Created July 2, 2015 07:01
Show Gist options
  • Save dnsilva/0e2b6a11f4acd30e492a to your computer and use it in GitHub Desktop.
Save dnsilva/0e2b6a11f4acd30e492a to your computer and use it in GitHub Desktop.
@shops = Shop.includes(concept: [:chain]).where(where_clause_map).order("#{attribute} #{ordering}").limit(params[:rowCount]).offset(offset)
Where:
Shop includes concept and in turn concept includes chain
and
where_clause_map looks like: {"id" => "[1,2]", "shop_concepts" => "1" ,"shop_chains.id"=> "1"}
NOTE: Using an array as in: "id" => "[1,2]" , causes the query to run as id IN (1, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment