niezdefiniowana metoda `default_scoped? ' podczas uzyskiwania dostępu do zakresu
Otrzymuję ten błąd podczas uzyskiwania dostępu do zakresów.
Oto model 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
i kiedy próbujęStatisticVariable.logins
lub jakiekolwiek inne zakresy, które daje:
NoMethodError: undefined method `default_scoped?'
Jeśli skonfiguruję zakres jako metodę klasy, to działa doskonale.
def self.registrations
where(code: 'registrations').first
end
Proszę, poproś mnie o zrozumienie i rozwiązanie tego problemu.