неопределенный метод default_scoped? при доступе к сфере
Я получаю эту ошибку при доступе к областям.
Вот модель AR
class StatisticVariable < ActiveRecord::Base
attr_accessible :code, :name
has_many :statistic_values
scope :logins, where(code: 'logins').first
scope :unique_logins, where(code: 'unique_logins').first
scope :registrations, where(code: 'registrations').first
end
и когда я пытаюсь сStatisticVariable.logins
или любые другие области, которые он дает:
NoMethodError: undefined method `default_scoped?'
Если я настраиваю область видимости как метод класса, тогда он работает отлично.
def self.registrations
where(code: 'registrations').first
end
Пожалуйста, помогите мне понять и исправить эту проблему.