collection.query.order, it will return an array of Query::Order instances that you can check. It might also be available from collection.query.to_hash[:order]
On Mar 5, 4:08 am, George <[email protected]> wrote: > Suppose a dm collection is being passed around before being used in a > view, how can I examine it to see if it has an :order attribute? (then > I'd add one if needed) > > For example if the collection has no :order then I need to set > collection = collection.all(:order=>:name) before using it, but if the > collection already has, say, :order => [ :updated_at, :name ] then I > don't want to override that. > > Many thanks for your help. The more I use dm the more impressed I am > with it! > George -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
