Top "Default-scope" questions

default order or where clause for all queries

Rails 4 default scope

In my Rails app have a default scope that looks like this: default_scope order: 'external_updated_at DESC' I …

ruby-on-rails-4 default-scope
Why is using the rails default_scope often recommend against?

Everywhere on the internet people mention that using the rails default_scope is a bad idea, and the top hits …

ruby-on-rails default-scope
default_scope in rails 3

I know named_scope has been changed to scope in rails 3. How do I perform default_scope in rails 3, I've …

ruby-on-rails activerecord scope default-scope
Rails 3 default scope, scope with override

I have a situation where the behavior of an existing app is changing and it's causing me a major headache. …

ruby-on-rails ruby-on-rails-3 activerecord named-scope default-scope
How to override default_scope in ActiveAdmin in Rails

In a resource registered with ActiveAdmin, I have the following default_scope defined for the model: default_scope :order => …

ruby-on-rails activeadmin default-scope
default_scope and associations

Suppose I have a Post model, and a Comment model. Using a common pattern, Post has_many Comments. If Comment …

ruby-on-rails default-scope
applying a default scope with reference to a relation in yii

I can't find too much documentation on applying a default scope to a model in yii, I was wondering if …

yii relation scopes default-scope
How can i have rspec test for my default scope

my model has default_scope(:order => 'created_at' ) my tests (rspec, factory girl, shoulda, etc.) are: require 'spec/spec_…

ruby testing rspec scope default-scope
Overriding default_scope in Rails

In my Post.rb model, I have default_scope :conditions => {:deleted => 'false'} But if I try to run …

ruby-on-rails models default-scope