I have a many-to-many relation table site_sections with the following columns:
id
site_id
section_id
which is used a join table between sections and sites tables. So one site has many sections and a section is available in many sites.
Sites table has the following columns:
id
store_number
The sites_sections table is used in a polymorphic association with parameters table.
I'd like to find all the parameters corresponding to the site sections for a specific site by its store_number. Is it possible to pass in an array of site_settings.id to SQL using the IN clause, something like that:
Parameter.where("parent_id IN (" + [1, 2, 3, 4] + ") and parent_type ='com.models.SiteSection'");
where [1, 2, 3, 4] should be an array of IDs from sites_sections table or there is a better solution ?