I think you might be better off running the query like PurchaseOrder.all(:completed => 'yes', :order => [:closed_date.desc]).items
Also, personally, if completed is just a string of yes or no, I'd use a boolean column (unless its a legacy db) On Fri, Oct 2, 2009 at 9:07 AM, ZHHZ <[email protected]> wrote: > > Hi, > > 0.10.0 breaks some of my code, here is my models: > > class PurchaseOrder > include ... > > property :closed_date, ... > > has n, items > end > > class PurchaseOrderLineItem > ... > belongs_to :po > end > > In 0.9, I was able to to something like: > order_by = [DataMapper::Query::Direction.new(PurchaseOrder.properties > [:closed_date], :desc)] > result = PurchaseOrderLineItem.first( 'po.completed.eql' => > 'yes', :order => order_by) > > But in 0.10, it's broken, I got: > +options[:order]+ entry :closed_date does not map to a property in > PurchaseOrderLineItem > > I must do it wrong in 0.10 or I missed something here, it seems like > all the properties in the :order option must be a valid property in > the model now( here is the PurchaseOrderLineItem), not a property of > the association. I know I can get a work around by query against on > the PurchaseOrder, I just curious is this the desired feature in > 0.10.0? > > Thanks. > > --Bruce > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
