ruby on rails - Different sort order for has_many :through relation -


i have following models set -

product has_many categories through categorisations category has_many products through categorisations 

i'm wondering correct way put products in different orders in each category. example, product might first in 1 category , last in another. ordering based purely on item appropriate in each category, rather alphabetical etc.

any suggestions welcome!

in categorisation model add column 'sort_order'.

also add following in categorisations model.

default_scope order("sort_order asc")  

Comments

Popular posts from this blog

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -