Displaying 1 result from an estimated 1 matches for "gtin".
Did you mean:
gain
2005 Dec 26
2
Dynamic order on has_many relationship?
...class Category < AR::B
has_many :products, :order => //something magical?//
end
class Category < AR:B
has_many :products, :order => "product_id"
has_many :products_by_desc, :class_name => "Product", :order =>
"description"
has_many :products_by_gtin, :class_name => "Product", :order => "gtin"
end
If I had a column that was default_order on the Category, could it
evaluate it and set the :order at the model level, or do I go in and
get my record set and hardcode which relationship matches which value
of the colum...