I have a simple models
class Item < ActiveRecord::Base
has_many :parts
end
class Part < ActiveRecord::Base
belongs_to :item
default_scope :order => :index
end
Each part has it's own index, to be ordered inside of the Item in question.
When i load parts for the item in ItemsController.show method, the parts are not ordered.
This is what happens in db:
[4;35;1mPart Load (0.7ms)[0m [0mSELECT "parts".* FROM "parts" WHERE ("parts".item_id = 165968587) [0m
Is't the "index" word reserved ?
Why ordering is not happens ?