Model dataset ordering

2010-03-17 Thread अमित चक्रदेव
Hi, I think this is a simple one, but could not figure this out myself. I am using the Sequel::Model interface. How do I specify ordering ? class Event Sequel::Model order :id end puts Event.last gives an error Sequel::Error: No order specified Event.dataset does not include ORDER BY 'id'

Re: Model dataset ordering

2010-03-17 Thread Aman Gupta
Event.set_dataset Event.dataset.order(:id) 2010/3/17 Amit Chakradeo (अमित चक्रदेव) chakra...@gmail.com: Hi,    I think this is a simple one, but could not figure this out myself. I am using the Sequel::Model interface. How do I specify ordering ? class Event Sequel::Model   order :id end

Re: Model dataset ordering

2010-03-17 Thread अमित चक्रदेव
Answering my own question, but the following works: class Event Sequel::Model self.dataset= self.dataset.order :id end But it sounds awkward, there must be a better way... --Amit 2010/3/17 Amit Chakradeo (अमित चक्रदेव) chakra...@gmail.com Hi, I think this is a simple one, but could

Re: Model dataset ordering

2010-03-17 Thread Aman Gupta
2010/3/17 Amit Chakradeo (अमित चक्रदेव) chakra...@gmail.com: Answering my own question, but the following works: class Event Sequel::Model   self.dataset= self.dataset.order :id end But it sounds awkward, there must be a better way... self.dataset.order!(:id) might work too --Amit

Re: Model dataset ordering

2010-03-17 Thread अमित चक्रदेव
On Wed, Mar 17, 2010 at 4:15 PM, Aman Gupta themastermi...@gmail.comwrote: self.dataset.order!(:id) might work too Yup, that works good! Thanks Aman, Amit -- You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group, send email to

Re: Model dataset ordering

2010-03-17 Thread Jeremy Evans
On Mar 17, 4:15 pm, Aman Gupta themastermi...@gmail.com wrote: self.dataset.order!(:id) might work too It does, but using dataset mutation methods on a model dataset is the path to madness. I would do: class Event Sequel::Model set_dataset dataset.order(:id) end Jeremy -- You