método indefinido `default_scoped? ' mientras se accede al alcance
Estoy recibiendo este error al acceder a ámbitos.
Aquí está el modelo 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
y cuando intento conStatisticVariable.logins
o cualquier otro ámbito que se le dé:
NoMethodError: undefined method `default_scoped?'
Si configuro el alcance como método de clase, entonces funciona perfectamente.
def self.registrations
where(code: 'registrations').first
end
Por favor guíame para entender y solucionar este problema.