I've got a model that I'm using a collection_select on and I'd like to scope it to show only accounts that are open. To accomplish this, I've added a ...
I've got a model that I'm using a collection_select on and I'd like to scope it to show only accounts that are open. To accomplish this, I've added a ...
I've got 3 classes. Country, City, and Activity. A country has_many cities and a city has_many activities. Some of the activities aren't ready yet, s ...
I'm wondering if there's a way to make one query to get the following conditions: 1) scope :scheduled_for, -> {where.not(:scheduled_for => nil) ...
I got a Product model with has_many Types table and several scopes: When I try to use one scope (Product.type1 for example) all goes well, but two ...
Say I have this scope: and I want an equivalent scope is there a way to alias one scope to another? For instance something like P.S. I know t ...
I have a table business_settings that uses key and value columns to store the settings for a business. I have written a helper to gather these values ...
I have 2 models Person and PersonInterest : People contains all the information about a person Person Interests stores the interests of a person (pers ...
In my offer.rb model I am doing some filtering after clients who have these offers. But I want to be able to pass another param in my scope to search ...
If I have 3 named scopes like And a function where variable is a string("test1","test2" or "test3") How can I access the named scope just by k ...
In my Rails 3.2.8 app I have some named scopes I would like to chain together in some circumstances. So, for example, I have these two scopes: I u ...
I was wondering if there's a method to detect if a scope is being used on an AR search in yii? For example, a model might contain 2 scopes: I'm ca ...
I've been trying to chain Arel queries using scopes, instead of just using some long-winded logic I wrote in the controller. But the scopes are slower ...