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

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -