Top "Named-scope" questions

How do you scope ActiveRecord associations in Rails 3?

I have a Rails 3 project. With Rails 3 came Arel and the ability to reuse one scope to build another. I …

ruby-on-rails activerecord ruby-on-rails-3 named-scope arel
What is scope/named_scope in rails?

I've recently started an internship. My employer uses ruby on rails, and I frequently encounter new syntax that I need …

ruby-on-rails named-scope
Is it possible to negate a scope in Rails 3?

I have the following scope for my class called Collection: scope :with_missing_coins, joins(:coins).where("coins.is_missing = ?", …

ruby-on-rails ruby named-scope
How to have multiple conditions in a named scope?

I have a User model. I can check whether a User is an admin by doing a_user.try(:admin?). …

ruby-on-rails model scope named-scope rails-models
Mongoid Scope order by syntax please

I'm using the latest mongoid... How do I do the mongoid equivalent of this active record named_scope: class Comment …

ruby-on-rails mongodb scope mongoid named-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
Can I use an ActiveRecord scope as an instance method?

I have a scope that acts as a filter. For instance: class User scope :in_good_standing, -> { where(:…

ruby-on-rails activerecord named-scope
undefined method `default_scoped?' while accessing scope

I am getting this error while accessing scopes. Here is AR model class StatisticVariable < ActiveRecord::Base attr_accessible :code, :…

ruby-on-rails ruby-on-rails-3 activerecord named-scope
Rails: Is that possible to define named scope in a module?

Say there are 3 models: A, B, and C. Each of these models has the x attribute. Is that possible to …

ruby-on-rails ruby-on-rails-3 named-scope
Matching available languages to language names

I want to make a language selection dropdown in a site user edit/create page. For this purpose, I have …

ruby-on-rails internationalization named-scope