Closed rctneil closed 7 months ago
I don't think you can stop it from adding position integers to the subclassed model but you can scope based on the type and the parent_id via an array [:type, :parent_id]
. That way missed coasters with the same parent won't confuse the coasters list.
What is :parent_id
?. Sorry, a bit lost with that.
Just replace that with whatever your scope id is (the belongs_to
that your items belong to). I just used parent_id as a generic term. If you don't have a scope like that and are just globally ordering your items then just use the type
column as the scope.
Ah ok, So acts_as_list scope: [:type]
should work to only apply ordering to "Coaster" records?,
Or, will Coaster records get one set order values, and MissedCoaster records get a second set of order values that I can sort of just ignore?
Yes, it would be the latter case.
Gotcha! Thankyou, I will try to give that a shot this weekend!
I have a Coaster model, I also have a MissedCoaster model that uses STI. So a MissedCoaster is a type of Coaster. I wish to add acts_as_list to Coasters but NOT on MissedCoasters.
Is this possible?