recibo este error al acceder a los ámbitos.método indefinido `default_scoped? ' al acceder al osciloscopio
Aquí es 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 con StatisticVariable.logins
o cualesquiera otros ámbitos que da:
NoMethodError: undefined method `default_scoped?'
Si configuro alcance que el método de la clase entonces funciona perfectamente.
def self.registrations
where(code: 'registrations').first
end
Por favor, ayúdenme a comprender y corregir este problema.
¡Ah, gracias por esto! Lo obtuve al cambiar el orden 'default_scope ':" foo "' to 'default_scope {{order:" foo "}}'. Se solucionó al cambiarlo a 'default_scope {order (" foo ")}'. –