Re: [Rails] how to set default_scope for the whole application?

2011-02-03 Thread Colin Law
On 2 February 2011 03:15, slava wrote: > I know I can set default_scope for individual active record model, but > can I set one up for the whole application? I guess you could derive a class from ActiveRecord::Base and put the default scope in there, then derive your models from that. I have not

Re: [Rails] how to set default_scope for the whole application?

2011-02-02 Thread Slava Mikerin
in what file do I put this or similar code? On Wed, Feb 2, 2011 at 11:00 AM, Slava Mikerin wrote: > I want is to set > default_scope :order => 'created_at ASC' > for all models on default. How is that done? > > > On Wed, Feb 2, 2011 at 6:23 AM, Walter Lee Davis wrote: > >> Well, I imagine you cou

Re: [Rails] how to set default_scope for the whole application?

2011-02-02 Thread Slava Mikerin
I want is to set default_scope :order => 'created_at ASC' for all models on default. How is that done? On Wed, Feb 2, 2011 at 6:23 AM, Walter Lee Davis wrote: > Well, I imagine you could, as long as all of your models had a key in > common. I mean, there's no practical difference between vanilla

Re: [Rails] how to set default_scope for the whole application?

2011-02-02 Thread Walter Lee Davis
Well, I imagine you could, as long as all of your models had a key in common. I mean, there's no practical difference between vanilla Rails and this: default_scope order('id ASC') But if all of your models had a :position maybe you could do this default_scope order('position ASC') and see

[Rails] how to set default_scope for the whole application?

2011-02-01 Thread slava
I know I can set default_scope for individual active record model, but can I set one up for the whole application? thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.