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
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
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
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
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.
5 matches
Mail list logo