Filtering by category in the model

In ubiquo_categories, there are mainly two ways to filter instances by the category name.

The first one is the built-in named scope. Let’s say we have the following

Now we can use the automatically generated “with_genres_in” named scope to filter by this field:

Pretty handy. The second option to filter, is to retrieve the condition hash and then use it at our discretion. For example, in ubiquo models we usually have the filtered_search method, if we want to integrate this filter it would be done with:

Where “value” can be a single element or an array of strings or Category instances.

Hope you find this useful!